Skip to content

Commit 96f6432

Browse files
committed
switch output to source path of the styleguide so the copy command can move everything at once
remove sass config from patternlab for now
1 parent 4a56ffa commit 96f6432

File tree

2 files changed

+16
-48
lines changed

2 files changed

+16
-48
lines changed

Gruntfile.js

Lines changed: 15 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,16 @@ module.exports = function(grunt) {
6262
copy: {
6363
main: {
6464
files: [
65-
{ expand: true, cwd: paths().source.js, src: '*', dest: paths().public.js},
66-
{ expand: true, cwd: paths().source.css, src: '*.css', dest: paths().public.css },
67-
{ expand: true, cwd: paths().source.images, src: ['**/*.png', '**/*.jpg', '**/*.gif', '**/*.jpeg'], dest: paths().public.images },
68-
{ expand: true, cwd: paths().source.fonts, src: '*', dest: paths().public.fonts},
69-
{ expand: true, cwd: paths().source.data, src: 'annotations.js', dest: paths().public.data}
70-
]
71-
},
72-
css: {
73-
files: [
74-
{ expand: true, cwd: paths().source.css, src: '*.css', dest: paths().public.css }
65+
{ expand: true, cwd: paths().source.js, src: '*.js', dest: paths().public.js},
66+
{ expand: true, cwd: paths().source.css, src: '*.css', dest: paths().public.css },
67+
{ expand: true, cwd: paths().source.images, src: ['**/*.png', '**/*.jpg', '**/*.gif', '**/*.jpeg'], dest: paths().public.images },
68+
{ expand: true, cwd: paths().source.fonts, src: '*', dest: paths().public.fonts},
69+
{ expand: true, cwd: paths().source.data, src: 'annotations.js', dest: paths().public.data}
7570
]
7671
},
7772
styleguide: {
7873
files: [
79-
{
80-
expand: true, cwd: paths().source.styleguide, src: ['*.*', '**/*.*'], dest: paths().public.styleguide
81-
}
74+
{ expand: true, cwd: paths().source.styleguide, src: ['*.*', '**/*.*'], dest: paths().public.styleguide }
8275
]
8376
}
8477
},
@@ -91,35 +84,9 @@ module.exports = function(grunt) {
9184
paths().source.patterns + '**/*.json',
9285
paths().source.data + '*.json'
9386
],
94-
tasks: ['default']
95-
},
96-
// scss: {
97-
// files: [paths().source.css + '**/*.scss', paths().source.styleguide + 'css/*.scss'],
98-
// tasks: ['sass', 'copy:css','bsReload:css']
99-
// },
100-
patterns: {
101-
files: [
102-
paths().source.patterns + '*.mustache',
103-
paths().source.patterns + '*.json',
104-
paths().source.data + '*.json'
105-
],
106-
tasks: ['default']
87+
tasks: ['default', 'bsReload:css']
10788
}
10889
},
109-
// sass: {
110-
// build: {
111-
// options: {
112-
// style: 'expanded',
113-
// precision: 8
114-
// },
115-
// files: {
116-
// paths().source.css + 'style.css': paths().source.css + 'style.scss',
117-
// paths().source.styleguide + 'css/static.css': paths().source.styleguide + 'css/static.scss',
118-
// paths().source.styleguide + 'css/styleguide.css': paths().source.styleguide + 'css/styleguide.scss',
119-
// paths().source.styleguide + 'css/styleguide-specific.css': paths().source.styleguide + 'css/styleguide-specific.scss'
120-
// }
121-
// }
122-
// },
12390
nodeunit: {
12491
all: ['test/*_tests.js']
12592
},
@@ -128,19 +95,23 @@ module.exports = function(grunt) {
12895
options: {
12996
server: paths().public.root,
13097
watchTask: true,
98+
watchOptions: {
99+
ignoreInitial: true,
100+
ignored: '*.html'
101+
},
131102
plugins: [
132103
{
133104
module: 'bs-html-injector',
134105
options: {
135-
files: paths().public + 'index.html'
106+
files: [paths().public.root + '/index.html', paths().public.styleguide + '/styleguide.html']
136107
}
137108
}
138109
]
139110
}
140111
}
141112
},
142113
bsReload: {
143-
css: paths().public + '**/*.css'
114+
css: paths().public.root + '**/*.css'
144115
}
145116
});
146117

@@ -154,15 +125,12 @@ module.exports = function(grunt) {
154125
//load the patternlab task
155126
grunt.task.loadTasks('./builder/');
156127

157-
//if you choose to use scss, or any preprocessor, you can add it here
158-
grunt.registerTask('default', ['patternlab', /*'sass',*/ 'copy:main']);
128+
grunt.registerTask('default', ['patternlab', 'copy:main', 'copy:styleguide']);
159129

160130
//travis CI task
161131
grunt.registerTask('travis', ['nodeunit', 'patternlab']);
162132

163-
//TODO: this line is more efficient, but you cannot run concurrent watch tasks without another dependency.
164-
//grunt.registerTask('serve', ['patternlab', /*'sass',*/ 'copy:main', 'copy:styleguide', 'browserSync', 'watch:patterns', 'watch:scss']);
165-
grunt.registerTask('serve', ['patternlab', /*'sass',*/ 'copy:main', 'copy:styleguide', 'browserSync', 'watch:all']);
133+
grunt.registerTask('serve', ['patternlab', 'copy:main', 'copy:styleguide', 'browserSync', 'watch:all']);
166134

167135
grunt.registerTask('build', ['nodeunit', 'concat']);
168136

builder/patternlab.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ var patternlab_engine = function (config) {
191191
//build the styleguide
192192
var styleguideTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'styleguide.mustache'), 'utf8'),
193193
styleguideHtml = pattern_assembler.renderPattern(styleguideTemplate, {partials: styleguidePatterns});
194-
fs.outputFileSync(path.resolve(paths.public.styleguide, 'html/styleguide.html'), styleguideHtml);
194+
fs.outputFileSync(path.resolve(paths.source.styleguide, 'html/styleguide.html'), styleguideHtml);
195195

196196
//build the viewall pages
197197
var prevSubdir = '',

0 commit comments

Comments
 (0)