nwb icon indicating copy to clipboard operation
nwb copied to clipboard

Create static demo page for github-pages

Open hackingbeauty opened this issue 8 years ago • 13 comments

After developing my component, I'd like to create a demo page and push to github-pages.

Can we create a command for this? Or does this use-case already exist?

hackingbeauty avatar Feb 27 '16 08:02 hackingbeauty

Is there a common workflow for that? Happy to add a per-repo command to make it easier.

insin avatar Feb 27 '16 10:02 insin

This is what I did for redux-send.

npm install --save-dev gulp gulp-gh-pages

No gulpfile involved! Just a one liner shell script:

  "scripts": {
    "gh-pages": "node -e \"require('gulp').src('demo/dist/**/*').pipe(require('gulp-gh-pages')())\""
  },

dtinth avatar Mar 16 '16 14:03 dtinth

i just tried this, but wanted to see if i could find a way that doesn't rely on gulp

for me this worked:

npm install --save-dev gh-pages

And in package.json:

"scripts": {
  "deploy": "gh-pages -d demo/dist"
}

I could take a stab at a PR for this if you're interested. I just found your project yesterday and i really enjoyed creating my first React component with it :+1:

I guess this could be another question after the jsNext question? If you would add this i'm assuming the default should be no?

novascreen avatar Apr 10 '16 23:04 novascreen

would be great to have @novascreen solution in the default template

revolunet avatar Oct 24 '16 22:10 revolunet

I've written up how to publish to GitHub pages here: https://notesfromthefrontend.wordpress.com/2016/11/16/publish-a-react-nwb-project-to-github-pages/

leanne1 avatar Nov 16 '16 15:11 leanne1

This should be added to the docs now that we have working examples, thanks for those.

insin avatar Jun 01 '17 12:06 insin

@insin has the docs for doing this been published yet? Thanks!

tnrich avatar Feb 13 '18 17:02 tnrich

@novascreen's solution works but renaming /demo to /docs might be simpler and more obvious. Or allowing this as a nwb config.

sconstantinides avatar May 17 '18 23:05 sconstantinides

So this worked.. initially... https://ravenhurst.github.io/react-flex-rating/

You can see my publish-demo script here: https://github.com/RavenHursT/react-flex-rating/blob/master/package.json#L21

But now I've made some updates... and while my gh-pages branch reflects those changes after running publish-demo again, the page still doesn't.

For example..

I have these transitions in the compiled css https://github.com/RavenHursT/react-flex-rating/blob/gh-pages/demo.c79dc9cc.css: image

But the css on the generated GH-page looks like an old version w/o the transitions: https://ravenhurst.github.io/react-flex-rating/demo.c79dc9cc.css

Is there some kind of caching or something keeping me from seeing the changes?

RavenHursT avatar Aug 14 '18 21:08 RavenHursT

The gh-pages can take up to 10 minutes to update.

Looks like the transitions are there too now

revolunet avatar Aug 15 '18 05:08 revolunet

Nope.. I did this yesterday, and the transitions still aren't there... also.. there's a min-width on the dropdowns to keep the labels from wrapping that aren't there either... 🤔

RavenHursT avatar Aug 15 '18 13:08 RavenHursT

this is what i have atm :

.rating .rating-icon{cursor:pointer;position:relative;display:inline-block}.rating.disabled{opacity:.5}.font-size-0{font-size:0!important}.font-size-0-5{font-size:.5rem!important}.font-size-1{font-size:1rem!important}.font-size-1-5{font-size:1.5rem!important}.font-size-2{font-size:2rem!important}.font-size-2-5{font-size:2.5rem!important}.font-size-3{font-size:3rem!important}.font-size-3-5{font-size:3.5rem!important}.font-size-4{font-size:4rem!important}.font-size-4-5{font-size:4.5rem!important}.font-size-5{font-size:5rem!important}.font-size-5-5{font-size:5.5rem!important}.font-size-6{font-size:6rem!important}.font-size-6-5{font-size:6.5rem!important}.font-size-7{font-size:7rem!important}.font-size-7-5{font-size:7.5rem!important}.font-size-8{font-size:8rem!important}.font-size-8-5{font-size:8.5rem!important}.font-size-9{font-size:9rem!important}.font-size-9-5{font-size:9.5rem!important}.font-size-10{font-size:10rem!important}.font-size-10-5{font-size:10.5rem!important}#demo .html-entities-rating{font-size:2rem}#demo .MuiFormControl-root-1{min-width:8em}#demo .rating .rating-icon>span>span{-webkit-transition:color .15s;-o-transition:color .15s;transition:color .15s}#demo .rating .rating-icon .display-icon{-webkit-transition:width 50ms;-o-transition:width 50ms;transition:width 50ms}#demo .rating .rating-icon .background-icon>span{color:#494949}#demo .rating .rating-icon .background-icon.highlight>span{color:#ffd34c}#demo .rating .rating-icon.active .display-icon>span,#demo .rating .rating-icon.half .display-icon>span{color:#db9f33}#demo .rating .rating-icon.highlight .display-icon>span{color:#ffd34c}
/*# sourceMappingURL=demo.c79dc9cc.css.map*/

also, the hash in the filename should prevent any cache issue

revolunet avatar Aug 15 '18 20:08 revolunet

Ok.. weird.. you are correct!

What's odd now, is how the classnames on the elements are now totally different!

image

Locally.. running the demo, the markup looks like this.. the class names are all different.

image

No wonder why the css isn't getting applied properly!

RavenHursT avatar Aug 15 '18 21:08 RavenHursT