forked from zurb/foundation-apps
/
Gruntfile.js
executable file
·148 lines (132 loc) · 3.69 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
module.exports = function(grunt) {
var hljs = require('highlight.js');
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
assemble: {
options: {
flatten: false,
assets: 'dist/assets/',
data: ['src/data/*.json'],
marked: {
gfm: true,
sanitize: false,
highlight: function(code, lang) {
if (lang === undefined) lang = 'bash';
if (lang === 'html') lang = 'xml';
if (lang === 'js') lang = 'javascript';
return '<div class="code-container">' + hljs.highlight(lang, code).value + '</div>';
}
}
},
dist: {
options: {
partials: ['docs/includes/*.html'],
helpers: ['docs/helpers/*.js'],
layout: 'docs/layouts/default.html'
},
expand: true,
cwd: 'docs/pages/',
src: '**/*.html',
dest: 'dist/'
}
},
autoprefixer: {
options: {
browsers: ['last 2 versions', 'ie 10']
},
single_file: {
expand: true,
flatten: true,
src: 'dist/assets/css/src/app.css',
dest: 'dist/assets/css/'
}
},
sass: {
options: {
loadPath: ['scss', 'scss/foundation']
},
dist: {
options: {
style: 'expanded',
lineNumbers: 'true'
},
files: {
'dist/assets/css/src/app.css': 'scss/app.scss'
}
}
},
copy: {
dist: {
files: [
{expand:true, cwd: 'src/assets/', src: ['**/*','!{scss,js}/**/*'], dest: 'dist/assets/', filter:'isFile'},
{expand:true, cwd: 'bower_components/modernizr/', src: 'modernizr.js', dest: 'dist/assets/js', filter:'isFile'}
]
}
},
uglify: {
dist: {
options: {
mangle: false,
beautify: true
},
files: {
'dist/assets/js/all.js': [
// Libraries
'bower_components/jqlite/jqlite.1.1.1.js',
'bower_components/fastclick/lib/fastclick.js',
'bower_components/notify.js/notify.js',
'bower_components/viewport-units-buggyfill/viewport-units-buggyfill.js',
'bower_components/tether/tether.js',
// Our stuff
'js/foundation.js',
'js/foundation.modal.js',
'js/foundation.notification.js',
'js/foundation.offcanvas.js',
'js/foundation.popup.js',
'js/app.js'
]
}
}
},
clean: ['dist/'],
watch: {
grunt: {
files: ['Gruntfile.js'],
tasks: ['build']
},
sass: {
files: 'scss/**/*.scss',
tasks: ['sass', 'autoprefixer']
},
copy: {
options: {cwd: 'src/assets/'},
files: ['**/*','!{scss,js}/**/*'],
tasks: ['copy']
},
uglify: {
options: {cwd: 'js'},
files: ['**/*.js'],
tasks: ['uglify']
},
assemble_all: {
files: ['docs/{includes,layouts}/**/*.html'],
tasks: ['assemble'],
options: {livereload:true}
},
assemble_pages: {
files: ['docs/pages/**/*.html'],
tasks: ['assemble'],
options: {livereload:true}
}
}
});
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('assemble');
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.registerTask('build', ['clean','sass', 'autoprefixer','uglify','assemble','copy']);
grunt.registerTask('default', ['build','watch']);
}