gulpとは
JavaScript製のタスク実行ツールです。
gulpの他にもGruntなるツールがあるようです。
Googleトレンドでは近年gulpがわずかに勝っています。
日本語圏ではgulpの人気が高いようです。
gulp環境の構築
以下をインストールします。
nodlist(0.8.7)
→node.jsのバージョン管理ツール。
Chocolatey(0.10.3)
→パッケージ管理ツール。類似のツールとしてはWinならPackageManagement(OneGet)などがあります。PackageManagementはインストールしたアプリの詳細(インストールしたパスなど)が見れないことや、その他使い勝手が悪かったので(PackageManagement (aka. OneGet) の利用時の簡単な注意)Chocolateyを利用しました。
node.jsのインストール
nodlist経由でnode.jsをインストールします。
※このとき一緒にnpmもインストールされます。
C:\WINDOWS\system32>nodist v4 v4 Installing 4.6.1 4.6.1 [===============] 13926/13926 KiB 100% 0.0s Installation successful.
バージョンは4.6.1でした。
C:\WINDOWS\system32>node -v v4.6.1
Chocolateyのインストール
管理者権限のコマンドプロンプトで以下を実行します。
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
RubyとPythonのインストール
Chocolateyを利用してインストールします。
PS C:\WINDOWS\system32> choco install -y ruby python Chocolatey v0.10.3 Installing the following packages: ruby;python By installing you accept licenses for the packages. ruby v2.3.1 [Approved] ruby package files install completed. Performing other installation steps. Get-BinRoot is going to be deprecated in v1 and removed in v2. It has been replaced with Get-ToolsLocation (starting with v0.9.10), however many packages no longer require a special separate directory since package folders no longer have versions on them. Some do though and should continue to use Get-ToolsLocation. WARNING: Url has SSL/TLS available, switching to HTTPS for download Downloading ruby 64 bit from 'https://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.3.1-x64.exe?direct' Progress: 100% - Completed download of C:\Users\sysadmin\AppData\Local\Temp\ruby\2.3.1\rubyinstaller-2.3.1-x64.exe (18.44 MB). Download of rubyinstaller-2.3.1-x64.exe (18.44 MB) completed. Hashes match. Installing ruby... ruby has been installed. Adding 'C:\tools\ruby23\bin' to the local path Environment Vars (like PATH) have changed. Close/reopen your shell to see the changes (or in powershell/cmd.exe just type `refreshenv`). The install of ruby was successful. Software installed to 'C:\tools\ruby23\' python3 v3.5.2.20161029 [Approved] python3 package files install completed. Performing other installation steps. Downloading python3 64 bit from 'https://www.python.org/ftp/python/3.5.2/python-3.5.2-amd64.exe' Progress: 100% - Completed download of C:\Users\sysadmin\AppData\Local\Temp\chocolatey\python3\3.5.2.20161029\python-3.5.2-amd64.exe (28.78 MB). Download of python-3.5.2-amd64.exe (28.78 MB) completed. Hashes match. Installing python3... python3 has been installed. Installed to 'C:\Python35' Environment Vars (like PATH) have changed. Close/reopen your shell to see the changes (or in powershell/cmd.exe just type `refreshenv`). The install of python3 was successful. Software installed as 'EXE', install location is likely default. python v3.5.2.20161029 [Approved] python package files install completed. Performing other installation steps. The install of python was successful. Software install location not explicitly set, could be in package or default install location if installer. Chocolatey installed 3/3 packages. 0 packages failed. See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
それぞれのバージョンは以下
C:\WINDOWS\system32>ruby -v ruby 2.3.1p112 (2016-04-26 revision 54768) [x64-mingw32] C:\WINDOWS\system32>python --version Python 3.5.2
gulpのインストール
npm(node.jsのパッケージ管理ツール)を利用してインストールします。
C:\WINDOWS\system32>npm install --global gulp-cli yo generator-webapp bower npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm C:\Program Files (x86)\Nodist\bin\bower -> C:\Program Files (x86)\Nodist\bin\node_modules\bower\bin\bower C:\Program Files (x86)\Nodist\bin\gulp -> C:\Program Files (x86)\Nodist\bin\node_modules\gulp-cli\bin\gulp.js ~略~ Yeoman Doctor Running sanity checks on your system ~略~ `-- yosay@1.2.1 +-- cli-boxes@1.0.0 +-- pad-component@0.0.1 +-- taketalk@1.0.0 | +-- get-stdin@4.0.1 | `-- minimist@1.2.0 `-- wrap-ansi@2.0.0
それぞれのバージョンは以下。
C:\WINDOWS\system32>gulp -v [21:17:46] CLI version 1.2.2 C:\WINDOWS\system32>yo --version 1.8.5
なお、node_modulesフォルダは「npm bin -g」で確認できます。
C:\WINDOWS\system32>npm bin -g C:\Program Files (x86)\Nodist\bin
スポンサーリンク