-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgruntfile.js
99 lines (85 loc) · 2.95 KB
/
gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
'use strict';
const sass = require('node-sass');
module.exports = grunt => {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
webFolder: 'docs',
sass: {
options: {
implementation: sass,
outputStyle: 'compressed'
},
sourceMapSimple: {
options: {
sourceMap: false
}
},
compile: {
files: {
'<%= webFolder %>/css/custom.css': 'src/sass/custom.scss',
}
}
},
uglify: {
srcjs: {
files: [{expand: true, cwd: 'src/js/core', src: '**.js', dest: '<%= webFolder %>/js/core/'}]
}
},
connect: {
server: {
options: {
hostname: '*',
livereload: true,
open: {
target: 'http://127.0.0.1:8000'
},
port: 8000,
useAvailablePort: true,
base: '<%= webFolder %>',
}
}
},
copy: {
libassets: {
files: [{expand: true, cwd: 'src/assets', src: '**/*', dest: '<%= webFolder %>/assets'}]
},
jsComponent:{
files: [{expand: true, cwd: 'src/js/component', src: '**/*', dest: '<%= webFolder %>/js/component'}]
},
jsLib:{
files: [{expand: true, cwd: 'src/js/lib', src: '**/*', dest: '<%= webFolder %>/js/lib'}]
}
},
clean: {
options: {force:true},
folderJs:{
src:['<%= webFolder %>/js/*']
},
folderAssets:{
src:['<%= webFolder %>/assets/*']
}
},
watch: {
options: {
livereload: true,
},
gruntfile: {files: ['Gruntfile.js'], tasks: ['default']},
sass: { files: ["src/sass/**/*.scss"], tasks: ["sass"] },
jsCore: {files: ['src/js/core/**.js'], tasks: ['uglify:srcjs']},
libassets: {files: ['src/assets/**/*'], tasks: ['clean:folderAssets','copy:libassets']},
jsComponent: {files: ['src/js/component/**'], tasks: ['copy:jsComponent']},
jsLib: {files: ['src/js/lib/**'], tasks: ['copy:jsLib']}
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-connect');
//Do not add watch to "default" task
grunt.registerTask('default', ['sass', 'uglify']);
grunt.registerTask('monitor', ['connect','sass','uglify', 'copy:libassets','copy:jsComponent','copy:jsLib','watch']);
// // solo para desarrollo
grunt.registerTask('dev', ['sass']);
};