-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
126 lines (124 loc) · 4.13 KB
/
Gruntfile.js
File metadata and controls
126 lines (124 loc) · 4.13 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
module.exports = function(grunt) {
grunt.initConfig({
browserSync: {
files: {
src: [
'index.html',
'desktop.html',
'dist/app.css',
'components/**/*.{js|html}'
]
},
options: {
watchTask: true,
server: {
baseDir: './',
}
},
},
concat: {
scripts: {
options: {
separator: ';',
banner: ";(function(window, undefined) {",
footer: "}(this));"
},
src: [
'bower_components/jquery/dist/jquery.min.js',
'bower_components/angular/angular.min.js',
'bower_components/angular-ui-router/release/angular-ui-router.min.js',
'bower_components/angular-ui-router/angular-ui-router.min.js',
'bower_components/add-to-homescreen/src/addtohomescreen.min.js',
'dist/_templates.js',
'components/app.module.js',
'components/**/*.js'
],
dest: 'dist/app.js'
}
},
html2js: {
options: {
module: 'templates',
base: './',
htmlmin: {
collapseBooleanAttributes: true,
collapseWhitespace: true,
removeAttributeQuotes: true,
removeComments: true,
removeEmptyAttributes: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true
}
},
main: {
src: ['components/**/*.tpl.html'],
dest: 'dist/_templates.js'
}
},
htmlmin: {
dev: {
files: {
'dist/index.html': 'index.html',
'dist/desktop.html': 'desktop.html',
}
}
},
imagemin: {
dynamic: {
files: [{
expand: true,
cwd: 'images/',
src: ['**/*.{png,jpg,gif}'],
dest: 'dist/images/'
}]
}
},
sass: {
dist: {
options: {
sourcemap: 'none'
},
files: {
// importing the other scss's in the 3pak.scss file
'dist/app.css': 'components/3pak.scss'
}
}
},
watch: {
sass: {
files: ['components/3pak.scss', 'components/**/*.scss'],
tasks: ['sass']
},
js: {
files: ['components/**/*.js'],
tasks: ['concat']
},
index: {
files: ['index.html', 'desktop.html'],
tasks: ['htmlmin']
},
templates: {
files: ['components/**/*.tpl.html'],
tasks: ['html2js', 'concat']
},
images: {
files: ['images/**/*.{png,jpg,gif}'],
tasks: ['imagemin']
}
}
});
// load npm tasks
grunt.loadNpmTasks('grunt-browser-sync');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-html2js');
// register custom tasks
grunt.registerTask('dev', ['browserSync', 'sass', 'watch']);
grunt.registerTask('default', ['browserSync', 'sass', 'html2js', 'concat', 'htmlmin', 'imagemin', 'watch']);
grunt.registerTask('serve', ['browserSync', 'watch']);
grunt.registerTask('build', ['sass', 'html2js', 'concat', 'htmlmin', 'imagemin']);
};