Last active
August 18, 2017 09:09
-
-
Save JeansBolong/1644d5e87023acadf462c7f6561680bd to your computer and use it in GitHub Desktop.
GRUNT TASK
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){ | |
grunt.initConfig({ | |
copy:{ | |
css:{ | |
files:[ | |
{ | |
cwd: 'folder/source/file', | |
src: '**/*.css', | |
dest: 'folder/target/', | |
expand: true | |
} | |
] | |
} | |
}, | |
watch:{ | |
options: { | |
spawn: false, | |
cwd: 'folder/yg/di/watch/' | |
}, | |
css: { | |
files: ['**/*.*'], | |
tasks: ['newer:copy:css'] | |
} | |
} | |
}); | |
grunt.loadNpmTasks('grunt-contrib-copy'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-newer'); | |
grunt.registerTask('build', ['watch:css']); | |
}; |
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) { | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
sass: { | |
dist: { | |
options: { | |
sourcemap: 'file', | |
style: 'expanded' | |
}, | |
files: [{ | |
expand: true, | |
cwd: 'source/folder', | |
src: ['**/*.scss'], | |
dest: 'destination/folder', | |
ext: '.css' | |
}] | |
} | |
}, | |
postcss: { | |
options: { | |
map: true, | |
processors: [ | |
require('autoprefixer')({ | |
browsers: ['last 2 versions'] | |
}) | |
] | |
}, | |
dist: { | |
src: 'destination/file' | |
} | |
}, | |
cssmin: { | |
target: { | |
files: [{ | |
expand: true, | |
cwd: 'source/folder', | |
src: ['*.css', '!*.min.css'], | |
dest: 'destination/folder', | |
ext: '.min.css' | |
}] | |
} | |
}, | |
watch: { | |
css: { | |
files: '**/*.scss', | |
tasks: ['sass','postcss','cssmin'] | |
} | |
} | |
}); | |
grunt.loadNpmTasks('grunt-contrib-sass'); | |
grunt.loadNpmTasks('grunt-postcss'); | |
grunt.loadNpmTasks('grunt-contrib-cssmin'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.registerTask('default',['watch']); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment