【问题标题】:Set specified build system as default for a file type on sublime text 2将指定的构建系统设置为 sublime text 2 上文件类型的默认值
【发布时间】:2012-04-28 20:56:32
【问题描述】:

我安装了包SASSSCSS。 SCSS 提供语法高亮,而 SASS 提供我需要的 scss 构建系统。我的问题是,如果构建设置为自动,如果我按 ctrl+b,它不会构建 scss 文件,所以我必须总是返回并重新选择该选项。有没有办法让构建系统成为 scss 的自动构建系统?

【问题讨论】:

    标签: build system sass sublimetext2


    【解决方案1】:

    使用构建系统进行设置并按 F7 启动: http://readthedocs.org/docs/sublime-text-unofficial-documentation/en/latest/file_processing/build_systems.html?highlight=build 了解有关设置的更多信息。

    更新答案

    复制以下内容:

    {
      "cmd": ["sass", "--update", "$file:${file_path}/${file_base_name}.css", "--stop-on-error", "--no-cache"],
      "selector": "source.sass, source.scss",
      "line_regex": "Line ([0-9]+):",
      "osx":
      {
        "path": "/usr/local/bin:$PATH"
      },
    
      "windows":
      {
        "shell": "true"
      }
    
    }
    

    在 Sublime Text 中,转到工具 > 构建系统 > 新构建系统 > 粘贴 给它一个名字。宾果游戏。

    更简单的方法

    SASS Support in Sublime

    Adding Support for near everything.

    最简单的方法

    当你不需要的时候为什么要DIY。

    希望每次保存时都在打开的浏览器中更新网站?

    1. 通常必须安装 Ruby Git 和 Python。
    2. 安装 Nodejs。 (win) 从主站点下载的 .msi 运行良好,包括 npm 现在您可以访问“gem”和“npm”包管理器。 现在事情变得容易了,虽然我不妨长篇大论地写出来。

    3. 指南针:

      宝石更新--系统 宝石安装指南针 // 现在可以使用这个命令来构建一个基于 sass 的项目 指南针创建 myFirstWebsite // ..安装在“/myFirstWebsite”中..

    4. 安装 Grunt 客户端(全局标志)

      npm install grunt-cli -g

    现在可以访问丰富的 Grunt 自动化软件包,即:

    npm grunt-contrib-jshint --save-dev
    

    “dev”标记 - 仅适用于您的本地项目(当前和子文件夹) 此外,在 package.json 中列为“devDependency”,这意味着它不会 在发行版/产品版本中包含您的项目

    1. 是时候做一些简单的真棒了...... Yeoman

      npm install yo -g

    安装 yeoman(yo 命令)一堆其他必需品 和 Bower - twitter 对 Node / Gem 等的回应 Bower 负责处理包依赖项。

    还有很棒的吗?

    // make a new folder. cd into it, and type:
    yo webapp
    
    // There are multiple 'generators' you can install with yo.
    // webapp is the one most suitable for front-end dev / web app building
    
    // other things you might want before you start.. maybe underscore:
    bower install underscore
    // adds '_' to the set-up as a dependency
    
    // These commands will brighten your day:
    grunt test      
    // comprehensive testing of app
    grunt server    
    // This part you'll love! Starts server and launches app in browser
    // - includes live-refreshing... save a file, and all required builds etc
    // are preformed (damn fast) and automatically refreshes browser.
    // Yup, 'grunt server' = project-wide equiv to 'compass watch'
    grunt
    // Build application for deploy. Not only do you get minification and concatenation;
    // also optimize all your image files, HTML, compile your CoffeeScript and Compass files, 
    // if you're using AMD, will pass those modules through r.js so you don't have to.
    

    【讨论】:

    • “使用构建系统设置并使用 F7 启动”,这是错误的。虽然,通过文档我找到了我的答案,所以感谢链接。该包没有将自己设置为文件类型的默认构建系统,因此我必须打开 .sublime-build 文件并自己添加它。
    • 正确。目前没有可以自动化这个过程的包 - 唉链接。可以在 Default(OS).sublime-keymap 中搜索构建并更改构建的键绑定 - 在我的系统上,我系统上的构建快捷键映射如下:{ "keys": ["f7"], "command": "build" }, { "keys": ["ctrl+b"], "command": "build" }。由于我没有更改默认值,只有用户键映射,我认为这是操作系统的公共键。我的猜测是,它是由另一个包添加的。
    • 这无济于事:链接上的说明只是针对问题的一种姿态,页面上没有指向更多相关材料的链接。我有一个与 OP 非常相似的问题,我不敢相信 OP 很满意。
    • 对不起@Tom,这和当时一样好。从那时起,可以通过包以及上面的手动设置获得更多选项。我会尽快发布全面的更新。
    猜你喜欢
    • 1970-01-01
    • 2011-11-26
    • 2012-08-02
    • 1970-01-01
    • 1970-01-01
    • 2023-03-22
    • 1970-01-01
    • 1970-01-01
    • 2013-12-17
    相关资源
    最近更新 更多