-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
150 lines (134 loc) · 3.49 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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
module.exports=function(grunt){
grunt.initConfig({
pkg:grunt.file.readJSON('package.json'),
concat: {
main: {
src: ['src/js/index.js'],
dest: 'temp/js/main.js',
},
jquery: {
src:['bower_components/jquery/dist/jquery.min.js'],
dest:'temp/js/jquery.js'
},
bootsrap: {
src:['bower_components/bootstrap/dist/js/bootstrap.min.js'],
dest:'temp/js/bootstrap.js'
},
components: {
src:['bower_components/AniJS/dist/anijs-min.js', 'bower_components/AniJS/dist/helpers/scrollreveal/anijs-helper-scrollreveal-min.js', 'bower_components/AniJS/dist/helpers/scrollreveal/anijs-helper-scrollreveal-min.js', 'bower_components/lightslider/dist/js/lightslider.min.js'],
dest:'temp/js/components.js'
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
files: {
src: ['temp/js/main.js']
}
},
jscs: {
files: {
src: ['temp/js/main.js']
},
options: {
config: ".jscsrc",
fix: true
}
},
uglify: {
options: {
stripBanners: true,
banner: '/* <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> */\n',
},
build: {
src:'temp/js/main.js',
dest:'temp/js/main.js'
}
},
less: {
development: {
options: {
paths: ['assets/less']
},
files: {
'temp/css/main.css': 'src/less/style.less',
'temp/css/components.css': 'src/less/components.less',
'temp/css/bootsrap.css': 'src/less/bootsrap.less'
},
}
},
htmlhint: {
options: {
htmlhintrc: '.htmlhintrc'
},
html1: {
src: ['temp/index.html']
}
},
csslint: {
options: {
csslintrc: '.csslintrc'
},
strict: {
options: {
import: 2
},
src: ['temp/css/main.css']
}
},
copy: {
main: {
files: [
{expand: true, flatten: true, src: ['src/index.html'], dest: 'temp/'},
{expand: true, flatten: true, src: ['src/icons/*'], dest: 'temp/icons/'},
{expand: true, flatten: true, src: ['src/fonts/*'], dest: 'temp/fonts/'},
{expand: true, flatten: true, src: ['src/images/*'], dest: 'temp/images/'},
{expand: true, src: ['bower_components/**/*'], dest: 'temp/'}
],
},
},
connect: {
server: {
options: {
port: 9000,
base: 'temp/.',
hostname: '0.0.0.0',
protocol: 'http',
livereload:35729,
open: true,
}
}
},
watch: {
another: {
files: ['src/icons/*', 'src/fonts/*', 'src/images/*', 'src/index.html'],
tasks: ['copy', 'htmlhint'],
},
less: {
files: ['src/**/*.less'],
tasks: ['less', 'copy','csslint'],
},
scripts: {
files: ['src/**/*.js'],
tasks: ['concat', 'uglify', 'copy'],
},
options: {
livereload: true,
},
},
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-htmlhint');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks("grunt-jscs");
grunt.registerTask('default',['concat', 'jshint', 'jscs', 'uglify', 'less', 'copy', 'csslint', 'htmlhint']);
grunt.registerTask('server', ['connect','watch']);
};