This repository was archived by the owner on Aug 21, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgruntfile.js
More file actions
136 lines (132 loc) · 4.03 KB
/
Copy pathgruntfile.js
File metadata and controls
136 lines (132 loc) · 4.03 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
127
128
129
130
131
132
133
134
135
136
module.exports = function(grunt) {
grunt.initConfig({
clean: {
build: {
src: ['tmp', 'dist']
},
postbuild: {
src: ['tmp']
}
},
copy: {
glyphicons: {
src: ['bower_components/bootstrap/fonts/*.*'],
dest: 'dist/fonts',
expand: true,
flatten: true,
},
images: {
src: ['src/images/*.*'],
dest: 'dist/images',
expand: true,
flatten: true,
}
},
pug: {
html: {
options: {
pretty: false,
},
files: [{
expand: true,
cwd: 'src/views',
src: ['index.pug'],
dest: 'tmp',
ext: '.html'
}]
}
},
stylus: {
css: {
files: {
'tmp/application.css': ['src/stylesheets/*.styl']
}
}
},
cssmin : {
application: {
options: {
keepSpecialComments: 0,
},
files: {
'tmp/stylesheet.css': [
'bower_components/bootstrap/dist/css/bootstrap.css',
'tmp/application.css'
]
}
}
},
uglify: {
application: {
options: {
beautify: false
},
files: {
'tmp/javascript.js': [
'bower_components/jquery/dist/jquery.js',
'bower_components/bootstrap/dist/js/bootstrap.js',
'bower_components/angular/angular.js',
'bower_components/angular-route/angular-route.js',
'bower_components/async/dist/async.js',
'bower_components/datejs/build/date.js',
'src/javascripts/*.js'
]
}
}
},
includereplace: {
all: {
files: {
'dist/index.html': ['tmp/index.html']
}
}
},
connect: {
server: {
options: {
port: 4000,
base: '',
hostname: 'localhost'
}
}
},
watch: {
stylesheets: {
files: '**/*.styl',
tasks: ['stylus', 'cssmin:application', 'pug', 'includereplace']
},
scripts: {
files: '**/*.js',
tasks: ['uglify:application', 'pug', 'includereplace']
},
pug: {
files: '**/*.pug',
tasks: ['pug', 'includereplace']
},
}
})
grunt.loadNpmTasks('grunt-contrib-clean')
grunt.loadNpmTasks('grunt-contrib-connect')
grunt.loadNpmTasks('grunt-contrib-copy')
grunt.loadNpmTasks('grunt-contrib-cssmin')
grunt.loadNpmTasks('grunt-contrib-pug')
grunt.loadNpmTasks('grunt-contrib-stylus')
grunt.loadNpmTasks('grunt-contrib-uglify')
grunt.loadNpmTasks('grunt-contrib-watch')
grunt.loadNpmTasks('grunt-include-replace')
grunt.registerTask(
'prepare',
'Compiles all of the assets and copies the files to the build directory.',
['clean:build', 'copy', 'pug', 'stylus', 'cssmin', 'uglify', 'includereplace']
)
grunt.registerTask(
'build',
'Compiles all of the assets and copies the files to the build directory. Cleanup all mess.',
['prepare', 'clean:postbuild']
)
grunt.registerTask(
'default',
'Watches the project for changes, automatically builds them and runs a server.',
['prepare', 'connect', 'watch']
)
}