-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
169 lines (154 loc) · 4.02 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/*
* Generated on 2015-05-18
* generator-assemble v0.5.0
* https://github.com/assemble/generator-assemble
*
* Copyright (c) 2015 Hariadi Hinta
* Licensed under the MIT license.
*/
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// '<%= config.src %>/templates/pages/{,*/}*.hbs'
// use this if you want to match all subfolders:
// '<%= config.src %>/templates/pages/**/*.hbs'
module.exports = function(grunt) {
require('time-grunt')(grunt);
require('load-grunt-tasks')(grunt);
// Project configuration.
grunt.initConfig({
config: {
src: 'src',
dist: 'dist'
},
watch: {
assemble: {
files: ['<%= config.src %>/{content,data,templates}/{,*/}*.{md,hbs,yml}'],
tasks: ['assemble']
},
css:{
files:['<%= config.src %>/assets/{,*/}*.css'],
tasks:['copy:theme']
},
js:{
files:['<%= config.src %>/assets/{,*/}*.js'],
tasks:['copy:themejs']
},
img:{
files:['<%= config.src %>/assets/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'],
tasks:['copy:themeimg']
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'<%= config.dist %>/{,*/}*.html',
'<%= config.dist %>/assets/{,*/}*.css',
'<%= config.dist %>/assets/{,*/}*.js',
'<%= config.dist %>/assets/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
]
}
},
connect: {
options: {
port: 9000,
livereload: 35729,
// change this to '0.0.0.0' to access the server from outside
hostname: 'localhost'
},
livereload: {
options: {
open: true,
base: [
'<%= config.dist %>'
]
}
}
},
assemble: {
pages: {
options: {
flatten: true,
assets: '<%= config.dist %>/assets',
layoutdir: '<%= config.src %>/templates/layouts',
layout: 'default.hbs',
data: '<%= config.src %>/data/*.{json,yml}',
partials: '<%= config.src %>/templates/partials/*.hbs'
},
files: {
'<%= config.dist %>/': ['<%= config.src %>/templates/pages/*.hbs']
}
}
},
copy: {
lightgallery: {
expand: true,
cwd: 'bower_components/lightgallery/dist/',
src: '**',
dest: '<%= config.dist %>/assets/js/plugins/lightgallery/'
},
jqmin: {
expand: true,
cwd: 'bower_components/jquery/dist/',
src: '{,*/}*.min.{js,map}',
dest: '<%= config.dist %>/assets/js/'
},
materialize: {
expand: true,
cwd: 'bower_components/materialize/dist/',
src: '**',
dest: '<%= config.dist %>/assets/'
},
theme: {
expand: true,
cwd: 'src/assets/',
src: '{,*/}*.css',
dest: '<%= config.dist %>/assets/css/'
},
themejs: {
expand: true,
cwd: 'src/assets/js',
src: '{,*/}*.js',
dest: '<%= config.dist %>/assets/js/'
},
themeimg: {
expand: true,
cwd: 'src/assets/img',
src: '{,*/}*.{jpg,png,gif}',
dest: '<%= config.dist %>/assets/img/'
}
},
autoprefixer: {
options: {
// Task-specific options go here.
browsers: ['last 2 versions', 'ie 8', 'ie 9']
},
single_file: {
options: {
// Target-specific options go here.
},
src: '<%= config.dist %>/assets/css/theme.css',
dest: '<%= config.dist %>/assets/css/creekside-prefixed.css'
},
},
// Before generating any new files,
// remove any previously-created files.
clean: ['<%= config.dist %>/**/*.{html,xml}']
});
grunt.loadNpmTasks('assemble');
grunt.registerTask('server', [
'build',
'connect:livereload',
'watch'
]);
grunt.registerTask('build', [
'clean',
'copy',
'assemble',
'autoprefixer'
]);
grunt.registerTask('default', [
'build'
]);
};