標籤:style http color os strong ar 2014 line
各位看官,小生最近在做前端自動化這塊,小有成效,記之,勿忘,同時為後來者前行做一個路標。
作業系統:win8
編輯器:Sublime
-
安裝外掛程式
a ctrl+shift+p,輸入install,斷行符號,
b 輸入CoffeeCompile
2. 安裝node
3. 安裝grunt,命令:npm install -g grunt-cli
安裝coffee-script,命令:npm install -g coffee-script
4. 下載jashkenas-coffeescript,官方地址:https://github.com/jashkenas/coffeescript
我的地址: http://pan.baidu.com/s/1hq7nF5U 密碼: ckcu
5. 添加coffee.cmd到node安裝目錄,
coffee.cmd內容如下:
@echo off
node.exe 步驟4 jashkenas-coffeescript的安裝目錄 %*
6. 添加環境變數 NODE_PATH=C:\Users\你的使用者名稱\AppData\Roaming\npm\node_modules;
7. sublime添加編譯
在Tools->build system->中點擊 new build system,
出現
將如下內容覆蓋:
{
"cmd": ["coffee.cmd的所在路徑", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.coffee",
"encoding":"cp936"
}
8. 添加文法高亮:下載CoffeeScript.tmLanguage,地址:https://github.com/jashkenas/coffee-script-tmbundle/blob/master/Syntaxes/CoffeeScript.tmLanguage
覆蓋到:C:\Users\使用者名稱\AppData\Roaming\Sublime Text 2\Packages\CoffeeScript
9. 在需要自動重新整理的頁面添加<script src="//localhost:35729/livereload.js"></script>
10. 在項目中添加package.json和Gruntfile.js,通過node.js command prompt工具,切到指定目錄,敲擊命令:grunt
11. 樣本Demo http://pan.baidu.com/s/1sjnY5FB 密碼: 62vb
12. 趕緊學習文法,翱翔吧! http://coffeescript.org/