2015年4月12日 星期日

sublime 安裝 less

1. 安裝[nodejs](https://nodejs.org/) 2. 開啟cmd,並執行 ```bash npm install -j less ``` 3. sublime安裝 LESS, smart less build 4. 修改smart less build設定檔 ```json { "source_map": false "custom_args": "--clean-css=\"--s1 --advanced --compatibility=ie8\"" } ```

sublime 安裝 coffeescript

1. 安裝[nodejs](https://nodejs.org/) 2. 開啟cmd,並執行 ```bash npm install -j coffee-script ``` 3. sublime安裝 Better CoffeeScript 4. 修改coffeescript設定檔 ```json { "checkSyntaxOnSave": true "lintOnSave": true "lintConfFile": true } ```

sublime syncing

windows內如何同步sublime的設定檔至多台電腦呢? 我們可以利用Dropbox加mklink的方式來做設定喔 請使用系統管理者權限開啟cmd 1.將已設定好的sublime的設定檔移至dropbox內 ```bash mkdir %USERPROFILE%\Dropbox\Sublime cd %APPDATA%\"Sublime Text 3\Packages" copy /Y User\* %USERPROFILE%\Dropbox\Sublime ``` 2.同步所有資料夾 ```bash cd %APPDATA%\"Sublime Text 3\Packages" rmdir /S /Q User mklink /D User %USERPROFILE%\Dropbox\Sublime ```

sublime terminail套件使用git bash

1.安裝 [git](http://git-scm.com/download/win) 2.sublime安裝Terminal 3.將Terminal => Settings - Default的內容複製到Terminal => Settings - User 4.修改 ```json { "terminal": C:\\Program Files\\Git\\git-bash" } ``` ![Alt text](http://1.bp.blogspot.com/-OTlq__5imw4/VSmcvnGcMVI/AAAAAAAANZ4/lWmRDaCk4co/s1600/Image%2B2.png) ![Alt text](http://1.bp.blogspot.com/-QUwHxCmXB5Q/VSmcvU1zWwI/AAAAAAAANZ0/-1DDG3fz1XQ/s1600/Image%2B3.png)

sublime安裝phpcs windows版

1.安裝sublime並安裝好package control 2.安裝phpcs 3.打開command並利用composer安裝 [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) [PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) [PHPMD](https://github.com/phpmd/phpmd) ```bash composer global require squizlabs/php_codesniffer fabpot/php-cs-fixer phpmd/phpmd ``` 4.將PHP Code Sniffer => Settings - Default的內容複製到 PHP Code Sniffer => Settings - User 5.修改Settings - User ```json { "phpcs_executable_path": "phpcs.bat", "php_cs_fixer_on_save": true, "php_cs_fixer_executable_path": "php-cs-fixer.bat", "phpcbf_on_save": true, "phpcbf_executable_path": "phpcbf.bat", "phpmd_run": true, "phpmd_executable_path": "phpmd.bat" } ``` 如果進行存檔時還是會提示錯誤訊息修改下列參數即可 ```json { "phpcs_php_prefix_path": "php路徑\\php.exe" } ``` 參考 [wamp安裝](http://phpwrite.blogspot.tw/2015/04/uniform.html) [composer安裝](http://phpwrite.blogspot.tw/2015/04/windowscomposer.html)

如何在windows下安裝composer

[composer](https://getcomposer.org/)是目前最多人使用的php套件管理單, 只要下一個指令, 就可以將所有套件相依性的軟體下載, 並只要require一隻autoload.php即可 不過要安裝composer有些步驟得進行, 說明一下如何安裝composer 1.下載windows版composer[下載](https://getcomposer.org/Composer-Setup.exe) 並安裝(安裝過程中,會要求指定php.exe資料夾) ![Alt text](http://2.bp.blogspot.com/-I2lmx3frsBo/VSl-HVy_XMI/AAAAAAAANZU/6fXNQbx-35c/s1600/Image%2B26.png) 2. 開始右鍵 => 系統 => 進階系統設定 => 環境變數 ![Alt text](http://1.bp.blogspot.com/-tkl3E_1MUec/VSl-EFSQIgI/AAAAAAAANYw/SNSpT9n7Gbk/s1600/Image%2B21.png) 3. 新增變數 變數名稱: PHP_HOME 變數值: PHP路徑(範例為C:\PHP) ![Alt text](http://2.bp.blogspot.com/-BhHP2Y-bOcI/VSl-FL0AORI/AAAAAAAANY4/VSXKh5nCfp0/s1600/Image%2B24.png) 4. 新增變數 變數名稱: COMPOSER_HOME 變數值: C:\ProgramData\ComposerSetup ![Alt text](http://3.bp.blogspot.com/-YSz19_BE54Y/VSl-ufDxGeI/AAAAAAAANZc/5BghqivaO-s/s1600/Image%2B27.png) 5. 修改path 在原本的path後面新增 ;%PHP_HOME%;%COMPOSER_HOME%\bin;%COMPOSER_HOME%\vendor\bin ※由於已經設定%COMPOSER_HOME%所以往後利用 composer global require 套件 都會安裝至%COMPOSER_HOME%\vendor 如果套件內有執行檔則會自動安裝至%COMPOSER_HOME%\vendor\bin 所以%COMPOSER_HOME%\vendor\bin也要加入path變數之中 6. 打開command模式,直接執行composer即可 ![Alt text](http://4.bp.blogspot.com/-pMGSUtfFi0E/VSl_L2L30QI/AAAAAAAANZk/sim4KTe3Fjk/s1600/Image%2B28.png)

uniform server 在windows下體積小快速安裝的wamp server

在Windows裡安裝wamp server 除了常見到的[xampp](https://www.apachefriends.org/zh_tw/index.html)、[wampserver](http://www.wampserver.com/en/)之外 還有這一套『[uniform server](http://www.uniformserver.com/)』 uniform server標榜的是體積小 主程式安裝檔案也才27M 不過相對功能就比較少 安裝程式只包含了apache、php5.4、mysql 其他的phpmyadmin、mariadb等等都可以利用plugin的方式來進行安裝 至於安裝的方法,只要將[檔案](http://sourceforge.net/projects/miniserver/files/latest/download?source=files)下載後,解壓縮到任一資料夾就可以使用了 以下為安裝步驟 1. 下載檔案(只有27M) ![Alt text](http://3.bp.blogspot.com/-1OpE5nbe0Ck/VSlkg8QGYPI/AAAAAAAANWk/rJxUuIhl_3E/s1600/Image%2B2.png) 2. 點擊兩下解壓縮 ![Alt text](http://3.bp.blogspot.com/-gVjjqAGz0ew/VSlk0H47fpI/AAAAAAAANWs/PRIZEwI5yCE/s1600/Image%2B4.png) 3. 進入UniServerZ資料夾 ![Alt text](http://4.bp.blogspot.com/-ULkt4QvuPs0/VSl01m_nBGI/AAAAAAAANYE/O1E0WMWwv0E/s1600/Image%2B6.png) 4. 點擊UniController.exe(用系統管理員身份執行才能設定開機後自動執行wamp) ![Alt text](http://4.bp.blogspot.com/--DmdLAlHbs0/VSl06KhuclI/AAAAAAAANYY/5e9c6N4YD74/s1600/Image%2B8.png) 5. 允許防火牆 ![Alt text](http://2.bp.blogspot.com/-sDRXg7jBMZk/VSl057qZF8I/AAAAAAAANYU/Q5U4Z-NQD8g/s1600/Image%2B9.png) 6. 更改mysql root預設密碼,不更改可直接點選cancel(預設密碼為 root) ![Alt text](http://1.bp.blogspot.com/-4ghg03Fjv4s/VSl0tPRYc_I/AAAAAAAANW8/7yd0XEumQFo/s1600/Image%2B10.png) 7. 啟動apache及mysql ![Alt text](http://3.bp.blogspot.com/-5krQE-FYZqQ/VSl0vwEy0-I/AAAAAAAANXQ/Cr0zYM18-zs/s1600/Image%2B14.png) 8. 設定開機執行apache及mysql ![Alt text](http://3.bp.blogspot.com/-O_Mh5zebdQw/VSl0uV1pF8I/AAAAAAAANXE/ssKUl8_9l5U/s1600/Image%2B15.png) ![Alt text](http://3.bp.blogspot.com/-7Q9jI4UrxZA/VSl0vaCw_4I/AAAAAAAANXM/4Prwe-USgCo/s1600/Image%2B16.png) 9. 這樣就設定完成了 ![Alt text]() 其他比較常用到的apache及php設定 1.設定apache rewrite 2.設定php curl 要更改apache及php的設得先停止apache 設定rewrite的方法 ![Alt text](http://1.bp.blogspot.com/-1LMH9PxQNrw/VSl0yKQ1YZI/AAAAAAAANXc/4HQM073XJpU/s1600/Image%2B17.png) ![Alt text](http://1.bp.blogspot.com/-GF7WQP9_j8c/VSl0y1oj6cI/AAAAAAAANXo/w3Z7lKYxfiw/s1600/Image%2B18.png) 設定php curl ![Alt text](http://2.bp.blogspot.com/-Jnbw7zkMobE/VSl0ywRbxkI/AAAAAAAANXg/AAsOvegL02I/s1600/Image%2B19.png) ![Alt text](http://3.bp.blogspot.com/-q_u8HNyhqMc/VSl00TMYGHI/AAAAAAAANX8/XqYM-jrOEqU/s1600/Image%2B20.png)