![]() ![]() In addition to compiling the project, we want to use Livereload in order to we see the changes at our code without refreshing the browser manually. Traditionally, we used to do that with compass compile or compass watch. Just for the sake of exercise, we are going to create a task, which will compile a project that we created with compass previously. Now we will answer a couple of questions (name, version, description etc) for generating the content of package.json. We can start creating package.json by npm init while at the project main index on terminal. Package.json : where we are holding the dependencies of the files that were installed for grunt. Gruntfile.js : file where we will organize the jobs of the grunt extensions that we installed However, for a healthier enviroment, we need to have two files named Gruntfile.js and Package.json If you are planning on using Grunt from now on, you can install Grunt for global use by: npm install -g grunt-cli Grunt Extensions InstallationĪfter the default installation, there is a short way of installing the Grunt package by using the command npm install packagename. If you are planning on using Grunt just once, or want to give it a try, go to the terminal and run: npm install grunt-cli After Node.js installation is done, let’s install Grunt. You can install the suitable version according to your platform from the download page. Grunt Installationįor Grunt, we need Node.js installed. This list can go on forever, but long story in short, we ease our workload by automating with Grunt instead of doing everything manually. (In case we are not using compass) Converting our images into sprite and forming CSS codes dynamically.Observing changes at our code without refreshing the browser window manually.Compressing images in a project and adding random keys to our file names in order to avoid our files being cached by users.Minifying CSS, JS files, which are the outcome of this process, to a single file.Compiling languages such as Coffeescript, Less, Sass/SCSS etc.Analyzing CSS and JavaScript code quality with various tools ( jshint, csslint).Some examples of where Grunt is useful are At VNGRS, we use Grunt for mainly automation tasks. Grunt is a quite popular, JavaScript based task runner which comes as a Node.js module.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |