SC5 / sc5-styleguide

Styleguide generator is a handy little tool that helps you generate good looking styleguides from stylesheets using KSS notation
http://styleguide.sc5.io/
MIT License
1.26k stars 171 forks source link

Additional postCSS plugins #825

Open faceleg opened 8 years ago

faceleg commented 8 years ago

I use a few postCSS plugins in my workflow. Is there a way to have sc5-styleguide use them as well?

When I attempt to run the given example in my gulpfile, I get sytnax errors due to the additional syntax my postCSS plugins allow.

varya commented 8 years ago

Could you provide the repo please? My suggestion is that you should use parsers: { 'postcss': 'postcss' } option from here https://github.com/SC5/sc5-styleguide#build-options but maybe something else, cannot guess without seeing your code.

grinkus-adapt commented 8 years ago

@varya Using CLI --parsers argument with option "{ css: 'postcss' }" and "{ postcss: 'postcss' }", the script reports the same error both times when using postcss-nested:

Parsing error: Please check validity of the block starting from line #8

7 | .test-component {
8*|     &::before {
9 |         content: 'Should work';
10 |    }

Syntax: css
Gonzales PE version: 3.0.0-31
grinkus-adapt commented 8 years ago

Here's a repo with code to reproduce the issue

grinkus-adapt commented 8 years ago

Oh and one more thing: currently I'm using the styleguide:ignore:start and styleguide:ignore:end flags in source css, but it would be awesome to get away without the ignore flags.

hannu commented 8 years ago

Currently postCSS support does not support additional plug-ins. The postCSS tree processing is located in https://github.com/SC5/sc5-styleguide/blob/master/lib/modules/parsers/postcss.js and currently it is not possible to inject 3rd party postCSS processers. However this is very useful feature so we consider implementing it.

glebmachine commented 8 years ago

Just plug your postcss in pipes after styleguide

grinkus-adapt commented 8 years ago

@glebmachine yep, that's the option I have resorted to now, but it is a workaround. It would be cool to have postcss additional plugin support. As hannu said, I think it should be considered for implementation.

glebmachine commented 8 years ago

@karolis-adapt not really. Piping postcss after styleguide is canonical gulp way to achieve your goal. Postccss integration is unnecessary here.

grinkus-adapt commented 8 years ago

@glebmachine wait a sec. I think I misunderstood your previous comment. Currently, I'm generating the styleguide using the built css files. If I use styleguide with postcss files (not piping anything anywhere except for the read stream I guess) the error mentioned in the original comment gets logged out. Not using gulp, just cli interface of sc5 styleguide.

glebmachine commented 8 years ago

@karolis-adapt Ou, i missunderstood you too. It's may possible to implement after this issue https://github.com/SC5/sc5-styleguide/issues/767

You still have option to create custom gulp postcss task, with full postprocessing chain btw.

varya commented 8 years ago

@faceleg @karolis-adapt Could you try out this version, does it help? https://github.com/SC5/sc5-styleguide/releases/tag/0.3.41 It does not work with PostCSS plugins yet, but uses PostCSS parser for the source code. It may be enough to avoid StyleGuide fail on your project.

grinkus-adapt commented 8 years ago

@varya the issue persists. Updated the issue example repo to use the latest sc5-styleguide.

faceleg commented 8 years ago

Wow I look away for a second and this blows up.

Thanks for continuing to work towards this!

stephenway commented 8 years ago

Has anyone gotten this to work?