|
1 | | -/* Grunt Task configuration */ |
2 | | -module.exports = function(grunt) { |
3 | | - |
4 | | - /* using jit-grunt for automatically loading all required plugins */ |
5 | | - require('jit-grunt')(grunt); |
6 | | - |
7 | | - grunt.initConfig({ |
8 | | - pkg: grunt.file.readJSON('package.json'), |
9 | | - |
10 | | - // Compile Sass to CSS and produce SoureMaps; |
11 | | - sass: { |
12 | | - options: { |
13 | | - sourceMap: true, |
14 | | - outputStyle: 'uncompressed' |
15 | | - }, |
16 | | - files: { |
17 | | - src: 'scss/main.scss', |
18 | | - dest: 'dist/css/styles.min.css', |
19 | | - ext: '.css' |
20 | | - } |
21 | | - }, |
22 | | - |
23 | | - // PostCSS for adding prefixers and setting rem to pixels; |
24 | | - postcss: { |
25 | | - dist: { |
26 | | - src: 'dist/css/styles.min.css' |
27 | | - |
28 | | - }, |
29 | | - options: { |
30 | | - // Rewrite and save sourcemap as seperate file |
31 | | - map: { |
32 | | - annotation: 'styles/' |
33 | | - }, |
34 | | - processors: [ |
35 | | - // add fallbacks for rem units |
36 | | - require('pixrem')({ |
37 | | - atrules: true |
38 | | - }), |
39 | | - // add vendor prefixes |
40 | | - require('autoprefixer')({ browsers: 'iOS >= 7, last 2 versions, ie > 7' }), |
41 | | - // minify the result |
42 | | - require('cssnano')() |
43 | | - ] |
44 | | - }, |
45 | | - }, |
46 | | - |
47 | | - watch: { |
48 | | - scss: { |
49 | | - files: ['scss/**/*.scss', 'node_modules/**/*.scss' ], |
50 | | - tasks: ['sass', 'postcss'], |
51 | | - options: { |
52 | | - spawn: false, |
53 | | - }, |
54 | | - }, |
55 | | - nunjucks: { |
56 | | - files: 'views/**/*.html', |
57 | | - tasks: ['nunjucks'], |
58 | | - options: { |
59 | | - spawn: false, |
60 | | - }, |
61 | | - } |
62 | | - }, |
63 | | - |
64 | | - nunjucks: { |
65 | | - render: { |
66 | | - options: { |
67 | | - paths: ['views'], |
68 | | - trimBlock: true, |
69 | | - lstripBlocks: true, |
70 | | - data: grunt.file.readJSON('templates-data.json') |
71 | | - }, |
72 | | - files: [ |
73 | | - { |
74 | | - expand: true, |
75 | | - cwd: "views/", |
76 | | - src: "*.html", |
77 | | - dest: "dist/", |
78 | | - ext: ".html" |
79 | | - } |
80 | | - ] |
81 | | - } |
82 | | - }, |
83 | | - |
84 | | - |
85 | | - }); |
86 | | - |
87 | | - grunt.loadNpmTasks('grunt-nunjucks-2-html'); |
88 | | - |
89 | | -/* |
90 | | -* Grunt tasks |
91 | | -* Run with grunt or grunt <command> in terminal |
92 | | -*/ |
93 | | -grunt.registerTask('default', 'run'); |
94 | | -grunt.registerTask('run', |
95 | | - [ |
96 | | - 'nunjucks', |
97 | | - 'sass', |
98 | | - 'postcss', |
99 | | - 'watch' |
100 | | - ] |
101 | | - ); |
102 | | -grunt.registerTask('create_css', |
103 | | - [ |
104 | | - 'sass', |
105 | | - 'postcss' |
106 | | - ] |
107 | | - ); |
108 | | -grunt.registerTask('create_html', |
109 | | - [ |
110 | | - 'nunjucks' |
111 | | - ] |
112 | | - ); |
113 | | -}; |
| 1 | +/* Grunt Task configuration */ |
| 2 | +module.exports = function(grunt) { |
| 3 | + |
| 4 | + /* using jit-grunt for automatically loading all required plugins */ |
| 5 | + require('jit-grunt')(grunt); |
| 6 | + |
| 7 | + grunt.initConfig({ |
| 8 | + pkg: grunt.file.readJSON('package.json'), |
| 9 | + |
| 10 | + // Compile Sass to CSS and produce SoureMaps; |
| 11 | + sass: { |
| 12 | + options: { |
| 13 | + sourceMap: true, |
| 14 | + outputStyle: 'uncompressed' |
| 15 | + }, |
| 16 | + files: { |
| 17 | + src: 'scss/main.scss', |
| 18 | + dest: 'dist/css/styles.min.css', |
| 19 | + ext: '.css' |
| 20 | + } |
| 21 | + }, |
| 22 | + |
| 23 | + // PostCSS for adding prefixers and setting rem to pixels; |
| 24 | + postcss: { |
| 25 | + dist: { |
| 26 | + src: 'dist/css/styles.min.css' |
| 27 | + |
| 28 | + }, |
| 29 | + options: { |
| 30 | + // Rewrite and save sourcemap as seperate file |
| 31 | + map: { |
| 32 | + annotation: 'styles/' |
| 33 | + }, |
| 34 | + processors: [ |
| 35 | + // add fallbacks for rem units |
| 36 | + require('pixrem')({ |
| 37 | + atrules: true |
| 38 | + }), |
| 39 | + // add vendor prefixes |
| 40 | + require('autoprefixer')({ browsers: 'iOS >= 7, last 2 versions, ie > 7' }), |
| 41 | + // minify the result |
| 42 | + require('cssnano')() |
| 43 | + ] |
| 44 | + }, |
| 45 | + }, |
| 46 | + |
| 47 | + watch: { |
| 48 | + scss: { |
| 49 | + files: ['scss/**/*.scss', 'node_modules/**/*.scss' ], |
| 50 | + tasks: ['sass', 'postcss'], |
| 51 | + options: { |
| 52 | + spawn: false, |
| 53 | + }, |
| 54 | + }, |
| 55 | + nunjucks: { |
| 56 | + files: 'views/**/*.html', |
| 57 | + tasks: ['nunjucks'], |
| 58 | + options: { |
| 59 | + spawn: false, |
| 60 | + }, |
| 61 | + } |
| 62 | + }, |
| 63 | + |
| 64 | + nunjucks: { |
| 65 | + render: { |
| 66 | + options: { |
| 67 | + paths: ['views'], |
| 68 | + trimBlock: true, |
| 69 | + lstripBlocks: true, |
| 70 | + data: grunt.file.readJSON('templates-data.json') |
| 71 | + }, |
| 72 | + files: [ |
| 73 | + { |
| 74 | + expand: true, |
| 75 | + cwd: "views/", |
| 76 | + src: "*.html", |
| 77 | + dest: "dist/", |
| 78 | + ext: ".html" |
| 79 | + } |
| 80 | + ] |
| 81 | + } |
| 82 | + }, |
| 83 | + browserSync: { |
| 84 | + dev: { |
| 85 | + bsFiles: { |
| 86 | + src : [ |
| 87 | + './dist/**/*.css', |
| 88 | + './dist/**/*.html', |
| 89 | + ] |
| 90 | + }, |
| 91 | + options: { |
| 92 | + watchTask: true, |
| 93 | + server: './dist/' |
| 94 | + } |
| 95 | + } |
| 96 | + |
| 97 | + } |
| 98 | + |
| 99 | + |
| 100 | + }); |
| 101 | + |
| 102 | + grunt.loadNpmTasks('grunt-nunjucks-2-html'); |
| 103 | + |
| 104 | +/* |
| 105 | +* Grunt tasks |
| 106 | +* Run with grunt or grunt <command> in terminal |
| 107 | +*/ |
| 108 | +grunt.registerTask('default', 'run'); |
| 109 | +grunt.registerTask('run', |
| 110 | + [ |
| 111 | + 'nunjucks', |
| 112 | + 'sass', |
| 113 | + 'postcss', |
| 114 | + 'browserSync', |
| 115 | + 'watch' |
| 116 | + ] |
| 117 | + ); |
| 118 | +grunt.registerTask('create_css', |
| 119 | + [ |
| 120 | + 'sass', |
| 121 | + 'postcss' |
| 122 | + ] |
| 123 | + ); |
| 124 | +grunt.registerTask('create_html', |
| 125 | + [ |
| 126 | + 'nunjucks' |
| 127 | + ] |
| 128 | + ); |
| 129 | +}; |
0 commit comments