Before Using this code you need to install some dependency.
- 1.grunt npm install
- 2. grunt watch
- 3. grunt express
Getting Started
you may install grunt plugin with this command:
npm install grunt --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-npm-install');
installing grunt watch
npm install grunt-watch --save-dev
installing grunt express
npm install grunt-express --save-dev
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
compile: {
files: {
'css/style.css': 'sass/style.sass'
}
}
},
watch: {
options: {
livereload: true
},
sass: {
files: 'sass/*.sass',
tasks: 'sass'
}
},
express: {
all: {
options: {
port: 9000,
hostname: 'localhost',
bases: ['.'],
livereload: true
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-express');
grunt.registerTask('default', ['sass']);
grunt.registerTask('server', ['express', 'watch']);
}
Run grunt all tasks, Type the below code in console
grunt server
To Run only sass compiler Task, Type the below code in console
grunt
use scss instade of sass, just change the extension to scss
watch: {
options: {
livereload: true
},
sass: {
files: 'sass/*.scss', // change extension from sass to scss
tasks: 'sass'
}
},
This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
0 comments:
Post a Comment