1
我已經在本地機器上安裝了「npm」。在我Gruntfile.js目錄,我在這過程中安裝咕嚕:咕嚕由於警告而中止
- NPM安裝咕嚕
- NPM安裝-g咕嚕-CLI
- 咕嚕手錶
這裏是我gruntfile.js文件
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
options: {
style: 'compact',
cacheLocation: 'assets/sass/.cache-location',
},
files: [{
'assets/css/dx-epb-admin.css': 'assets/css/scss/dx-epb-admin.scss',
'assets/css/dx-epb-public.css': 'assets/css/scss/dx-epb-public.scss',
'assets/css/dx-epb-grid.css': 'assets/css/scss/dx-epb-grid.scss',
}],
},
},
autoprefixer:{
dist: {
files: {
'assets/css/dx-epb-admin.css': 'assets/css/dx-epb-admin.css',
'assets/css/dx-epb-admin-new.css': 'assets/css/dx-epb-admin-new.css',
'assets/css/dx-epb-public.css': 'assets/css/dx-epb-public.css',
'assets/css/dx-epb-grid.css': 'assets/css/dx-epb-grid.css',
},
},
},
watch: {
scripts: {
files: ['assets/js/src/*.js'],
tasks: ['jshint', 'uglify'],
},
css: {
files: [ 'assets/css/**/*.scss', 'assets/css/*.css' ],
tasks: ['sass', 'autoprefixer', 'cssmin'],
},
},
cssmin: {
options: {
shorthandCompacting: false,
roundingPrecision: -1
},
target: {
files: {
'assets/css/dx-epb-admin.min.css': ['assets/css/dx-epb-admin.css'],
'assets/css/dx-epb-admin-new.min.css': ['assets/css/dx-epb-admin-new.css'],
'assets/css/dx-epb-public.min.css': ['assets/css/dx-epb-public.css'],
'assets/css/dx-epb-grid.min.css': ['assets/css/dx-epb-grid.css'],
}
}
},
uglify: {
target: {
files: {
'assets/js/dx-epb-admin.min.js':
[
'assets/js/src/dx-epb-admin.js',
],
'assets/js/dx-epb-admin-new.min.js':
[
'assets/js/src/dx-epb-admin-new.js',
],
'assets/js/dx-epb-admin-save.min.js':
[
'assets/js/src/dx-epb-admin-save.js',
],
'assets/js/dx-epb-control.min.js':
[
'assets/js/src/dx-epb-control.js',
],
'assets/js/dx-epb-media-upload.min.js':
[
'assets/js/src/dx-epb-media-upload.js',
],
'assets/js/dx-epb-public.min.js':
[
'assets/js/src/dx-epb-public.js',
],
'assets/js/dx-epb-tinymce-button.min.js':
[
'assets/js/src/dx-epb-tinymce-button.js',
]
}
}
},
jshint: {
all: ['Gruntfile.js', 'assets/js/scripts.js'],
},
});
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', ['watch']);
grunt.registerTask('css', ['sass', 'autoprefixer']);
grunt.registerTask('minify', ['cssmin']);
grunt.registerTask('minifyjs', ['uglify']);
};