Created
December 13, 2019 09:48
-
-
Save Danushka181/d4ed6368bcc37d0e9853dec3059430ac to your computer and use it in GitHub Desktop.
Grunt file with compressed and customized
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
// Load automatically all tasks without using grunt.loadNpmTasks() | |
// for each module | |
require('load-grunt-tasks')(grunt); | |
/* --------------------------------------- | |
* Tasks configuration | |
* --------------------------------------- */ | |
grunt.initConfig({ | |
/* | |
* Paths | |
*/ | |
paths: { | |
resources: 'scss', // source files (scss) | |
assets: '' // compiled files (css) | |
}, | |
/* | |
* SASS task | |
*/ | |
sass: { | |
// For development | |
dev: { | |
files: { | |
'style.css' : '<%= paths.resources %>/style.scss' | |
}, | |
options: { | |
style: 'compressed' //nested, compact, compressed, expanded | |
} | |
}, | |
// For production | |
prod: { | |
files: { | |
'<%= paths.assets %>/css/main.css' : '<%= paths.resources %>/sass/main.scss' | |
}, | |
options: { | |
style: 'compressed', // //nested, compact, compressed, expanded | |
sourcemap: 'none' | |
} | |
} | |
}, | |
/* | |
* Watch task | |
*/ | |
watch: { | |
sass: { | |
files: [ | |
'<%= paths.resources %>/**/*.scss' // Write here the files that Grunt must watches | |
], | |
tasks: ['sass:dev'] | |
}, | |
uglify: { | |
files:[ | |
'js/app.js' | |
], | |
tasks: ['uglify:minfiles'] | |
} | |
}, | |
uglify: { | |
minfiles: { | |
options: { | |
sourceMap: { | |
includeSources: true | |
}, | |
}, | |
files: { | |
'dest/app.min.js': 'js/app.js', | |
}, | |
} | |
} | |
}); | |
/* --------------------------------------- | |
* Registered tasks | |
* --------------------------------------- */ | |
grunt.registerTask('default', ['sass:dev']); | |
grunt.registerTask('jsmin', ['uglify:minfiles']); | |
grunt.registerTask('prod', ['sass:prod']); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment