-
Notifications
You must be signed in to change notification settings - Fork 21
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
Use with LESS/SASS? #5
Comments
Yep! Works in any file and file type that can support jsDoc-like syntax (meaning the |
@straker Appreciate it! Any chance you know of a good example of this? Having trouble getting going, trying to start mine with gulp & less. |
@straker NM, got it! I'll post how I did it here when I get a little further along. Might make a PR with a LESS example. |
Ok. For future reference, I got things rolling with a gulp file that looked like so:
I copied the template file from the |
Glad you got it working. Why did you need to copy the template into your directory? Was it not loading properly? |
I wanted to copy the template so I could customize the style of the actual style guide, but it also allowed me to import my compiled styles file manually into the demos. Couldn't figure out how to have livingcss recognize my compiled less styles through the options (if that's possible). In all it would be helpful to have a demo of options used in the gulp-livingcss version like you show in the node version's readme. |
I see. There's actually is a way to bring in any stylesheets you need into the demos. It's not an option but actually part of customizing the context object by adding onto the So for your less files you'd probably do the following (making use of the utility functions): gulp.task('patterns', function () {
gulp.src('less/*.less')
.pipe(livingcss({
loadcss: false,
preprocess: function(context, template, Handlebars) {
return livingcss.utils.readFileGlobs('./css/*', function(data, file) {
context.stylesheets.push(file);
}
}))
.pipe(gulp.dest('pattern_library'))
}); I'll make a demo of doing something like this for future reference since it's definitely not clear enough in the docs. Thanks for bringing it to my attention. |
@straker Ok so was trying to get this working. Getting this err: |
You're right. The function is only made available from the node version of livingcss, but not on the gulp version. I'll create an issue on the gulp-livingcss repo to add the utility functions onto the gulp plugin. |
Alright, latest gulp-livingcss now exposes the utility functions. |
Wooot! Many thanks @straker For the record, now that that's all good I was able to import my compiled less styles by compiling the less first into a
Side note: This is by far the best pattern library generator, I'm off and running. You can see mine as it grows here if looking for reference. |
Awesome, glad everything worked out for you. I'll add an example of using LESS/SASS as the file sources soon. Thanks for the great compliment. |
Bah, one last nbd hangup. So that ^Had to add that for the future me figuring it out. All set. |
Ya, copying the files over would destroy any relative file paths to images and whatnot, so I just reference them to preserve that. I'll make sure to point that out as well. |
Shadow DOM in safari and firefox didn't work, so trying to encapsulate the styles didn't work. Switched to using polymer to create the proper encapsulation with shady DOM in all browsers. However, this means I need to inline both polymer and all style guide styles in order to reduce FOUC and get proper heights for calculating scroll positions. also: * docs(@page): add example of multiple pages (#7) * docs(preprocessor): add example of using a preprocessor (#5) * fix(utils): fix readFiles to not error when passed `undefined` closes #7 closes #5
I added an example for future reference. |
By chance does livingcss work with LESS/SASS css pre-processors? Was hoping to do something like...
Or something.
Thanks!
The text was updated successfully, but these errors were encountered: