-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using with gulp #161
Comments
// Include Gulp & Tools We'll Use
var gulp = require('gulp'),
shell = require('gulp-shell');
// Build styleguide.
gulp.task('styleguide', ['clean:styleguide', 'styleguide:markup'], shell.task([
// kss-node [source folder of files to parse] [destination folder] --template [location of template files]
'kss-node <%= source %> <%= destination %> --template <%= template %>'
], {
templateData: {
source: 'path/to/sass',
destination: 'path/to/styleguide',
template: 'path/to/styleguide/template'
}
}
)); It works well enough. And is really fast. I understand that dropping to a shell is going to be slower than direct API configuration, but the other changes to kss-node have been much higher priority. |
I think that #138 is required in order to "use this (cleanly) with gulp". |
I use gulp-run to run CLI. It might not be the best way but it does work
|
var options = {}; // Sets various paths in my app.
var flags = [
'--source', options.theme.sass,
'--source', options.theme.css + 'style-guide/',
'--destination', options.rootPath.styleGuide,
'--css', options.theme.css + 'styles.css',
'--homepage', 'homepage.md',
'--title', 'Zen 7.x-6.x Style Guide'
];
gulp.task('styleguide', function(cb) {
var cmd = spawn('kss-node', flags, {stdio: 'inherit'});
return cmd.on('close', cb);
}); |
From #252:
Here's my new gulp task: // Other options.* set earlier in my gulpfile.js
options.styleGuide = {
source: [
options.theme.sass
],
destination: options.rootPath.styleGuide,
// The css and js paths are URLs, like '/misc/jquery.js'.
// The following paths are relative to the generated style guide.
css: [
path.relative(options.rootPath.styleGuide, options.theme.css + 'styles.css'),
path.relative(options.rootPath.styleGuide, options.theme.css + 'style-guide/chroma-kss-styles.css'),
path.relative(options.rootPath.styleGuide, options.theme.css + 'style-guide/kss-only.css')
],
js: [
],
homepage: 'homepage.md',
title: 'Zen 7.x-6.x Style Guide'
};
// kss-node 2.3.1 and later.
var kss = require('kss');
gulp.task('styleguide', function(cb) {
kss(options.styleGuide, cb);
}); [Edit: for kss-node 3.x… ] // kss-node 3.0.0-beta1 and later.
var kss = require('kss');
gulp.task('styleguide', function() {
return kss(options.styleGuide);
}); Pretty simple, yes! In 3.x, I'd like to make it possible for KSS to handle gulp.src and gulp.dest. |
KSS has been implemented into gulp Gulp command: gulp stylguide, gulp watch Styleguide Location: wp-content/themes/atomic-roots/styleguide/section-components.html#section-components.button Gulp Implmentation taken from kss-node/kss-node#161 !*FIX*! Provide better folder location for styleguide Make BwoserSnc refresh stylguide pages
kss --version 3.0.0-beta.14
Edit: Remove Callback, according to Johns following comment. |
@digitaldonkey Almost. kss-node 3.x supports Promises as does Gulp. So you should remove the gulp.task('styleguide', function () {
return kss(options.styleGuide);
}); |
The up to date gulp 4 way const kss = require('kss');
const kssConfig = require('./kss.json');
function styleguide() {
return kss(kssConfig);
}
styleguide.description = 'Build the style guide with KSS';
export.styleguide = styleguide; |
Hi!
Amazing work! I really love what you're doing.
A question: How can I use this (cleanly) with gulp? I'd like to be able to use it by harnessing the module api, not dropping down to an exec on the command line. Is this possible?
The text was updated successfully, but these errors were encountered: