yii2-and-gulp
yii2-and-gulp copied to clipboard
Simple app with working Yii2 asset command and Gulp
Yii2 and Gulp
Simple app with working Yii2 asset command and Gulp.
This is configured yiisoft/yii2-app-basic which uses Gulp.
App installation
- Install NodeJS from here
- Install Gulp globaly
npm install -g gulp.- IMPORTANT: Make sure that Gulp works fine. Check it with
gulp --version, if it works you should see something likeCLI version 3.8.11
- IMPORTANT: Make sure that Gulp works fine. Check it with
- Clone this repository
git clone https://github.com/lukicdarkoo/yii2-and-gulp.git- Navigate to
/yii2-and-gulpand runcomposer update --prefer-dist - Navigate to
/yii2-and-gulp/tools/gulpand runnpm update
- Navigate to
- To generate combined and compressed *.js and *.css files navigate to
/yii2-and-gulpand runyii asset tools/gulp/assets-config.php config/assets-prod.php - FINISH! Run app and check source code, you should see only one *.js and one *.css file, combined and compressed.
Integrate to your app
- Copy directory
/toolsto your application - Change bundles and targets for your needs in
/tools/grunt/assets-config.php, check Yii2 Guide Using the asset Command - Configure component to your config file:
'assetManager' => [
'bundles' => require(__DIR__ . '/' . 'assets-prod.php' ),
],
- Install NodeJS from here
- Install Gulp globaly
npm install -g gulp.- IMPORTANT: Make sure does Gulp work fine. Check it with
gulp --version, if it works you should see something likeCLI version 3.8.11
- IMPORTANT: Make sure does Gulp work fine. Check it with
- Navigate to
/your-app-root/tools/gulpand runnpm update - To generate combined and compressed *.js and *.css files navigate to
/your-app-rootand runyii asset tools/gulp/assets-config.php config/assets-prod.php - FINISH! Run app and check source code, you should see only one *.js and one *.css file, combined and compressed.