-
Notifications
You must be signed in to change notification settings - Fork 0
/
gruntfile.js
141 lines (138 loc) · 4.06 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
'use strict';
module.exports = function (grunt) {
grunt.initConfig({
watch: {
styles: {
files: [
'assets/styles/**/*.less',
],
tasks: ['styles'],
},
main: {
files: [
'assets/scripts/**/*.js',
],
tasks: ['uglify:main', 'jshint', 'jscs',],
},
bower_components: {
files: [
'bower_components/**/*'
],
tasks: ['all'],
},
python: {
files: [
'bikeanjo.py',
],
tasks: ['flake8',],
},
},
uglify: {
options: {
sourceMap: true,
sourceMapIncludeSources: true,
compress: true,
},
vendor: {
files: {
'static/js/vendor.js': [
'bower_components/jquery/dist/jquery.js',
'bower_components/bootstrap/dist/js/bootstrap.js',
],
},
},
main: {
files: {
'static/js/main.js': [
'assets/scripts/**/*.js',
],
},
},
},
less: {
options: {
compress: true,
sourceMap: true,
outputSourceFiles: true,
},
app: {
options: {
sourceMapFilename: 'main.css.map',
},
files: {
'static/css/main.css': 'assets/styles/*.less',
},
},
},
rename: {
csssourcemap: {
src: 'main.css.map',
dest: 'static/css/',
},
},
copy: {
main: {
files: [
{expand: true, flatten: false, cwd: 'assets/fonts/', src: ['**'], dest: 'static/fonts/', filter: 'isFile',},
{expand: true, flatten: false, cwd: 'assets/imgs/', src: ['*'], dest: 'static/imgs/', filter: 'isFile',},
],
},
},
jshint: {
options: {
reporter: require('jshint-stylish'),
globals: {
jQuery: true,
},
force: true,
},
all: [
'assets/scripts/**/*.js',
],
},
jscs: {
src: 'assets/scripts/**/*.js',
options: {
requireCurlyBraces: ['if', ],
force: true,
disallowMixedSpacesAndTabs: true,
},
},
flake8: {
options: {
force: true,
errorsOnly: true,
maxLineLength: 250,
},
src: ['landing.py', ],
},
browserSync: {
options: {
watchTask: true, // < VERY important
},
app: {
bsFiles: {
src : [
'static/css/*.css',
'static/js/*.js',
'templates/*.html',
]
},
},
},
});
// load npm tasks
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-rename');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-jscs');
grunt.loadNpmTasks('grunt-flake8');
grunt.loadNpmTasks('grunt-browser-sync');
// define default task
grunt.registerTask('styles', ['less', 'rename',]);
grunt.registerTask('all', ['uglify', 'jshint', 'jscs', 'flake8', 'styles', 'copy'])
grunt.registerTask('default', ['all', 'browserSync', 'watch',]);
};