-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
101 lines (100 loc) · 3.11 KB
/
build.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
var metalsmith = require('metalsmith'),
markdown = require('metalsmith-markdown'),
twig = require('metalsmith-twig-540'),
browsersync = require('metalsmith-browser-sync'),
collections = require('metalsmith-collections-540'),
permalinks = require('metalsmith-permalinks'),
branch = require('metalsmith-branch'),
beautify = require('metalsmith-beautify'),
copyassets = require('metalsmith-copy-assets-540'),
sass = require('metalsmith-sass'),
autoprefixer = require('metalsmith-autoprefixer');
metalsmith(__dirname)
.use(collections({
posts: {
pattern: 'content/posts/*.md',
sortBy: 'date',
reverse: true
}
}))
.use(sass({
outputDir: 'css/',
outputStyle: 'expanded',
}))
.use(autoprefixer({browsers: ['> 1%', 'last 2 versions', 'IE >= 9']}))
.use(copyassets({
src: [
'src/assets/vendor/jquery/dist/jquery.min.js',
'src/assets/js/jquery.appear.js',
'src/assets/vendor/jquery-validation/dist/jquery.validate.min.js',
'src/assets/vendor/jquery-validation/src/localization/messages_es.js',
'src/assets/vendor/foundation/js/foundation.min.js',
'src/assets/vendor/modernizr/modernizr.js',
'src/assets/vendor/masonry/dist/masonry.pkgd.min.js',
'src/assets/vendor/imagesloaded/imagesloaded.pkgd.min.js',
'src/assets/vendor/fastclick/lib/fastclick.js',
'src/assets/js/app.js',
'src/assets/js/slick.min.js'
],
dest: 'js'
}))
.use(copyassets({
src: [
'src/assets/images/main',
'src/assets/images/about',
'src/assets/images/posts',
'src/assets/images/clients',
'src/assets/images/technologies',
],
dest: 'images'
}))
.use(copyassets({
src: [
'src/assets/vendor/font-awesome/css/font-awesome.min.css',
'src/assets/css'
],
dest: 'css'
}))
.use(copyassets({
src: [
'src/assets/vendor/font-awesome/fonts',
'src/assets/fonts/fontello',
'src/assets/fonts/nevis',
'src/assets/fonts/slick'
],
dest: 'fonts'
}))
.use(copyassets({
src: [
'src/assets/extra/CNAME',
],
dest: ''
}))
.use(markdown())
.use(branch('content/pages/*.html')
.use(permalinks({
pattern: ':title'
})))
.use(branch('content/posts/*.html')
.use(permalinks({
pattern: 'blog/:title'
})))
.use(twig())
.use(beautify({
css: false,
indent_size: 4,
indent_char: ' ',
js: {
"indent_size": 2
}
}))
//.use(function (files, metalsmith, done) {
// console.log(metalsmith.metadata().collections.posts)
// done();
//})
.use(browsersync({
files: ['src/assets/**/*', 'src/*.md', 'src/**/*.md', 'src/**/**/*.md', 'views/*.twig', 'views/**/*.twig']
}))
.build(function (err) {
if (err) throw err;
});