straker / livingcss

Parse comments in your CSS to generate a living style guide using Markdown, Handlebars, Polymer, and Prism syntax highlighter.
MIT License
241 stars 21 forks source link

Example of pages #7

Closed lisadlh closed 8 years ago

lisadlh commented 8 years ago

I love using this to create a styleguide, but haven't been able to consistently create pages based on the documentation. Could you please add an example showing how to create several styleguide pages? Thanks!

straker commented 8 years ago

Can do, will get it into the next release.

straker commented 8 years ago

Does this stylesheet help you better understand how to achieve multiple pages in the style guide?

epka commented 8 years ago

I have also had trouble generating pages. I have setup with three pages (each with sections and subsections). I have defined @page tag in stylesheet with the first occurrence of section tag (example:

@section Buttons
@page components

Running my gulp script runs through, but after finishing throws this stream.push error: ('...' represents part of path to project folder)

[12:04:16] Finished 'release' after 4.71 μs Error: stream.push() after EOF at readableAddChunk (/Users/ ... /node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:179:15) at DestroyableTransform.Readable.push (/Users/.../node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:157:10) at DestroyableTransform.Transform.push (/Users/.../node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:123:32) at success (/Users/.../node_modules/gulp-livingcss/index.js:73:17) Error: stream.push() after EOF at readableAddChunk (/Users/... /node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:179:15) at DestroyableTransform.Readable.push (/Users/... /node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:157:10) at DestroyableTransform.Transform.push (/Users/... /node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:123:32) at success (/Users/... /node_modules/gulp-livingcss/index.js:73:17)

And html for only first page will be generated. If I run the script again, second file will be generated (with same error) and third time I get the third file. I have no sorting for the pages/sections defined in gulp.

Am I missing something crucial or what goes wrong here ? Any help appreciated. I can live with running script thrice, but it feels shaky :-)

lisadlh commented 8 years ago

Hi, the example definitely helped understand the syntax. The documentation has "+" at the line starts instead of '*' which caused some confusion.

/* + Section belonging to a page. ` +@section Section Name +@page Page Name */`

However, I am also getting stream.push() after EOF errors when testing with you example, but only get one page written out (typography.html) even after repeated runs:

Error: stream.push() after EOF at readableAddChunk (D:\nodejs\styleguide\node_modules\through2\node_modules \readable-stream\lib_stream_readable.js:179:15) at DestroyableTransform.Readable.push (D:\nodejs\styleguide\node_modules\thr ough2\node_modules\readable-stream\lib_stream_readable.js:157:10) at DestroyableTransform.Transform.push (D:\nodejs\styleguide\node_modules\th rough2\node_modules\readable-stream\lib_stream_transform.js:123:32) at success (D:\nodejs\styleguide\node_modules\gulp-livingcss\index.js:73:17)

I am using your gulp-livingcss. Maybe I'm missing a node module?

straker commented 8 years ago

If you are see + symbols, those are inserted by git to show changed lines. If you copied the + symbols into your code, that will throw the errors. Instead, you should look at the raw version when copying code.

@epka did you also try to use my example with the + symbols?

lisadlh commented 8 years ago

I used your raw version to test locally to make sure there were no typos.

The '+' instead of '@' I got from the main page: https://github.com/straker/livingcss

straker commented 8 years ago

Holy crap, I didn't even know the main page had those +'s! I'll get those fixed ASAP, no wonder everyone's having problems. I'm sorry.

straker commented 8 years ago

Ok, fixed the docs

epka commented 8 years ago

Hi, I didn't have +'s on start of line. I have:

 * @section Buttons
 * @page components

And to clarify, I get that EOF error in every run. I'm clueless why, and it seems plain weird: (so I have three pages defined: components, elements and modules. On first run, it creates components and fails, On second it creates elements and fails, On third it creates modules and fail

I cannot test now if it touches already created files on subsequent runs.

And, actually I get EOF error twice at end of each run :-)

straker commented 8 years ago

Ok, I just noticed that you're using the gulp-livingcss, so I'll have to investigate why that one's having issues with multiple pages.

lisadlh commented 8 years ago

Great, thanks! Let me know if you have any questions about my set up.

straker commented 8 years ago

Alright, latest gulp-livingcss should fix this issue.

epka commented 8 years ago

Cool. Seems to work now. Thanks !

This whole LivingCSS is really cool package. So happy came across it, I have been looking for Styleguide engine that's versatile enough for a while.

epka commented 8 years ago

Hi Just been able to get back to this to test {markdown} (works nicely!)

However, after updating to gulp-livingcss 2.0.2 this same (above) error resurfaced. 2.0.1. seems to work ok though ??

straker commented 8 years ago

Thats strange, I'll see why that happened.

straker commented 8 years ago

So I'm testing this and I can't reproduce the error with this file:

/**
 * Page 1
 * @section Page 1
 * @page Page 1
 */

/**
 * Page 2
 * @section Page 2
 * @page Page 2
 */

The gulp task completes and outputs 2 pages as expected.

epka commented 8 years ago

Hmmm....ok. Thanks for looking this up. Then it's probably my file or setup. Have to dig deeper. It's probably best to rebuild the project folder. Are the newest versions released through npm?

I'm also doing preprocess sorting of pages: sortOrder: [ ['index', 'components', 'elements', 'modules'] ]

straker commented 8 years ago

@epka any luck figuring out what was going on? (And yes, npm versions are up-to-date)

epka commented 8 years ago

Hi, thanks for following up. Unfortunately not. Had to do some firefighting in another project, so this has been on hold. I'm resuming work on style guide next week, starting to try sort this out. I'll report back if or when I get it rollllng again 😁

straker commented 8 years ago

I'll close for now. If you find anything wrong with livingcss, go ahead create a new issue.