generator-yeogurt
generator-yeogurt copied to clipboard
Static assets copying
When requiring boostrap-sass is there a way to copy over the font files? or are we to create a gulp copy task?
I just started to use the generator, please excuse me for my ignorance.
Hey @mattts,
Good question! Here is an example of a new task called copy:bootstrapFonts
that you can add to the gulp/copy.js
file:
'use strict';
import path from 'path';
export default function(gulp, plugins, args, config, taskTarget, browserSync) {
let dirs = config.directories;
let dest = path.join(taskTarget);
let fontDest = path.join(dirs.source, 'fonts');
// Copy
gulp.task('copy', () => {
return gulp.src([
path.join(dirs.source, '**/*'),
'!' + path.join(dirs.source, '{**/\_*,**/\_*/**}'),
'!' + path.join(dirs.source, '**/*.jade')
])
.pipe(plugins.changed(dest))
.pipe(gulp.dest(dest));
});
// Copy over boostrap fonts to `src/fonts` folder
gulp.task('copy:bootstrapFonts', () => {
return gulp.src([
path.join('node_modules/bootstrap-sass/assets/fonts/', '**/*')
])
.pipe(plugins.changed(fontDest))
.pipe(gulp.dest(fontDest));
});
}
Then within the your gulpfile, you can add this new task to your serve
and build
tasks like so:
// Build production-ready code
gulp.task('build', [
'copy',
'copy:bootstrapFonts',
'imagemin',
'jade',
'less',
'browserify'
]);
// Server tasks with watch
gulp.task('serve', [
'imagemin',
'copy',
'copy:bootstrapFonts',
'jade',
'less',
'browserify',
'browserSync',
'watch'
]);
Let me know if that works. Cheers :beers:
Awesome works like a charm :clap: ,
I would suggest to add this to the docs if it makes sense.
@mattts, Glad to hear it worked well for you.
I will be writing a guide shortly on how to add Bootstrap to a Yeogurt project. It seems many users are having some trouble implementing Non-CommonJS libs to their projects, so putting some Docs together seems like the next logical step.
I'll keep this issue open until the guide is ready to go, in case any other users find it helpful.
@larsonjj Any updates on the guide yet? Struggling a little to get Bootstrap working in my Yeogurt project!