May 17, 2015 by Anuraj
You can install bower as well like this.
You can create a basic gulp task like the following, gand save it in gulpfile.js
And you can run this task by “gulp helloworld”, it will print HelloWorld in the console.
If you create task with name ‘default’, you can run this task by executing command ‘gulp’, you don’t need to specify the task name.
You will find lot of plugins for gulp, to achieve various tasks.
Similar to gulp, bower also works on bower.json file. You can create a bower file using “bower init” command.
Which will create a bower.json file like this.
You can use Visual Studio code, to edit bower.json file, it supports auto completion of packages. Here is the updated bower.json file with bootstrap package added.
You can install bower components using “bower install” command. It will download the packages and dependencies which is required for the package as well, similar to nuget.
For minification and bundling you need to install various gulp plugins. You need to install all these plugins using npm install command.
- gulp concat - Combines multiple files
- gulp cssmin - Minify CSS files
You need to add both bower_components and node_modules in the exclude folder list in project.json file, otherwise you will get some compile time errors. Here is the exclude section from project.json file.
If you are using Visual Studio 2015, you can execute gulp tasks as part of build events, this will not work if you are using Visual Studio code, either you can use task runner option in VS code, or you need to use scripts section in the project.json file.
Happy Programming :)
Full Source code - https://github.com/anuraj/HelloMVC
Copyright © 2024 Anuraj. Blog content licensed under the Creative Commons CC BY 2.5 | Unless otherwise stated or granted, code samples licensed under the MIT license. This is a personal blog. The opinions expressed here represent my own and not those of my employer. Powered by Jekyll. Hosted with ❤ by GitHub