|
1 | 1 | module.exports = function (grunt) {
|
2 | 2 |
|
3 |
| - var path = require('path'); |
4 |
| - |
5 |
| - function paths() { |
6 |
| - return require('./patternlab-config.json').paths; |
7 |
| - } |
8 |
| - |
9 |
| - // Project configuration. |
| 3 | + /****************************** |
| 4 | + * Project configuration. |
| 5 | + * Should only be needed if you are developing against core, running tests, linting and want to run tests or increment package numbers |
| 6 | + *****************************/ |
10 | 7 | grunt.initConfig({
|
11 | 8 | pkg: grunt.file.readJSON('package.json'),
|
12 | 9 | concat: {
|
13 | 10 | options: {
|
14 | 11 | stripBanners: true,
|
15 |
| - banner: '/* \n * <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy") %> \n * \n * <%= pkg.author %>, and the web community.\n * Licensed under the <%= pkg.license %> license. \n * \n * Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice. \n *\n */\n\n', |
| 12 | + banner: '/* \n * <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy") %> \n * \n * <%= pkg.author.name %>, <%= pkg.contributors[0].name %>, and the web community.\n * Licensed under the <%= pkg.license %> license. \n * \n * Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice. \n *\n */\n\n', |
16 | 13 | },
|
17 | 14 | patternlab: {
|
18 | 15 | src: './core/lib/patternlab.js',
|
19 | 16 | dest: './core/lib/patternlab.js'
|
20 |
| - }, |
21 |
| - object_factory: { |
22 |
| - src: './core/lib/object_factory.js', |
23 |
| - dest: './core/lib/object_factory.js' |
24 |
| - }, |
25 |
| - lineage: { |
26 |
| - src: './core/lib/lineage_hunter.js', |
27 |
| - dest: './core/lib/lineage_hunter.js' |
28 |
| - }, |
29 |
| - media_hunter: { |
30 |
| - src: './core/lib/media_hunter.js', |
31 |
| - dest: './core/lib/media_hunter.js' |
32 |
| - }, |
33 |
| - patternlab_grunt: { |
34 |
| - src: './core/lib/patternlab_grunt.js', |
35 |
| - dest: './core/lib/patternlab_grunt.js' |
36 |
| - }, |
37 |
| - patternlab_gulp: { |
38 |
| - src: './core/lib/patternlab_gulp.js', |
39 |
| - dest: './core/lib/patternlab_gulp.js' |
40 |
| - }, |
41 |
| - parameter_hunter: { |
42 |
| - src: './core/lib/parameter_hunter.js', |
43 |
| - dest: './core/lib/parameter_hunter.js' |
44 |
| - }, |
45 |
| - pattern_exporter: { |
46 |
| - src: './core/lib/pattern_exporter.js', |
47 |
| - dest: './core/lib/pattern_exporter.js' |
48 |
| - }, |
49 |
| - pattern_assembler: { |
50 |
| - src: './core/lib/pattern_assembler.js', |
51 |
| - dest: './core/lib/pattern_assembler.js' |
52 |
| - }, |
53 |
| - pseudopattern_hunter: { |
54 |
| - src: './core/lib/pseudopattern_hunter.js', |
55 |
| - dest: './core/lib/pseudopattern_hunter.js' |
56 |
| - }, |
57 |
| - list_item_hunter: { |
58 |
| - src: './core/lib/list_item_hunter.js', |
59 |
| - dest: './core/lib/list_item_hunter.js' |
60 |
| - }, |
61 |
| - style_modifier_hunter: { |
62 |
| - src: './core/lib/style_modifier_hunter.js', |
63 |
| - dest: './core/lib/style_modifier_hunter.js' |
64 |
| - } |
65 |
| - }, |
66 |
| - copy: { |
67 |
| - main: { |
68 |
| - files: [ |
69 |
| - { expand: true, cwd: path.resolve(paths().source.js), src: '*.js', dest: path.resolve(paths().public.js) }, |
70 |
| - { expand: true, cwd: path.resolve(paths().source.css), src: '*.css', dest: path.resolve(paths().public.css) }, |
71 |
| - { expand: true, cwd: path.resolve(paths().source.images), src: ['**/*.png', '**/*.jpg', '**/*.gif', '**/*.jpeg'], dest: path.resolve(paths().public.images) }, |
72 |
| - { expand: true, cwd: path.resolve(paths().source.fonts), src: '*', dest: path.resolve(paths().public.fonts) }, |
73 |
| - { expand: true, cwd: path.resolve(paths().source.data), src: 'annotations.js', dest: path.resolve(paths().public.data) } |
74 |
| - ] |
75 |
| - }, |
76 |
| - styleguide: { |
77 |
| - files: [ |
78 |
| - { expand: true, cwd: path.resolve(paths().source.styleguide), src: ['*.*', '**/*.*'], dest: path.resolve(paths().public.styleguide) } |
79 |
| - ] |
80 |
| - } |
81 |
| - }, |
82 |
| - watch: { |
83 |
| - all: { |
84 |
| - files: [ |
85 |
| - path.resolve(paths().source.css + '**/*.css'), |
86 |
| - path.resolve(paths().source.styleguide + 'css/*.css'), |
87 |
| - path.resolve(paths().source.patterns + '**/*.mustache'), |
88 |
| - path.resolve(paths().source.patterns + '**/*.json'), |
89 |
| - path.resolve(paths().source.fonts + '/*'), |
90 |
| - path.resolve(paths().source.images + '/*'), |
91 |
| - path.resolve(paths().source.data + '*.json'), |
92 |
| - path.resolve(paths().source.js + '/*.js') |
93 |
| - ], |
94 |
| - tasks: ['default', 'bsReload:css'] |
95 | 17 | }
|
96 | 18 | },
|
97 | 19 | nodeunit: {
|
98 | 20 | all: ['test/*_tests.js']
|
99 | 21 | },
|
100 |
| - browserSync: { |
101 |
| - dev: { |
102 |
| - options: { |
103 |
| - server: path.resolve(paths().public.root), |
104 |
| - watchTask: true, |
105 |
| - watchOptions: { |
106 |
| - ignoreInitial: true, |
107 |
| - ignored: '*.html' |
108 |
| - }, |
109 |
| - snippetOptions: { |
110 |
| - // Ignore all HTML files within the templates folder |
111 |
| - blacklist: ['/index.html', '/', '/?*'] |
112 |
| - }, |
113 |
| - plugins: [ |
114 |
| - { |
115 |
| - module: 'bs-html-injector', |
116 |
| - options: { |
117 |
| - files: [path.resolve(paths().public.root + '/index.html'), path.resolve(paths().public.styleguide + '/styleguide.html')] |
118 |
| - } |
119 |
| - } |
120 |
| - ], |
121 |
| - notify: { |
122 |
| - styles: [ |
123 |
| - 'display: none', |
124 |
| - 'padding: 15px', |
125 |
| - 'font-family: sans-serif', |
126 |
| - 'position: fixed', |
127 |
| - 'font-size: 1em', |
128 |
| - 'z-index: 9999', |
129 |
| - 'bottom: 0px', |
130 |
| - 'right: 0px', |
131 |
| - 'border-top-left-radius: 5px', |
132 |
| - 'background-color: #1B2032', |
133 |
| - 'opacity: 0.4', |
134 |
| - 'margin: 0', |
135 |
| - 'color: white', |
136 |
| - 'text-align: center' |
137 |
| - ] |
138 |
| - } |
139 |
| - } |
140 |
| - } |
141 |
| - }, |
142 | 22 | eslint: {
|
143 | 23 | options: {
|
144 | 24 | configFile: './.eslintrc'
|
145 | 25 | },
|
146 | 26 | target: ['./core/lib/*']
|
147 |
| - }, |
148 |
| - bsReload: { |
149 |
| - css: path.resolve(paths().public.root + '**/*.css') |
150 | 27 | }
|
151 | 28 | });
|
152 | 29 |
|
153 | 30 | // load all grunt tasks
|
154 |
| - require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks); |
155 |
| - |
156 |
| - //load the patternlab task |
157 |
| - grunt.task.loadTasks('./core/lib/'); |
158 |
| - |
159 |
| - grunt.registerTask('default', ['patternlab', 'copy:main', 'copy:styleguide']); |
| 31 | + grunt.loadNpmTasks('grunt-contrib-concat'); |
| 32 | + grunt.loadNpmTasks('grunt-eslint'); |
| 33 | + grunt.loadNpmTasks('grunt-contrib-nodeunit'); |
160 | 34 |
|
161 | 35 | //travis CI task
|
162 |
| - grunt.registerTask('travis', ['nodeunit', 'eslint', 'patternlab']); |
163 |
| - |
164 |
| - grunt.registerTask('serve', ['patternlab', 'copy:main', 'copy:styleguide', 'browserSync', 'watch:all']); |
| 36 | + grunt.registerTask('travis', ['nodeunit', 'eslint']); |
165 | 37 |
|
| 38 | + //to be run prior to releasing a version |
166 | 39 | grunt.registerTask('build', ['nodeunit', 'eslint', 'concat']);
|
167 | 40 |
|
168 | 41 | };
|
0 commit comments