hyperstack-org / hyperstack

Hyperstack ALPHA https://hyperstack.org
https://docs.hyperstack.org
MIT License
540 stars 41 forks source link

should `extract_css` be true? #286

Open catmando opened 4 years ago

catmando commented 4 years ago

In config/webpacker.yml the extract_css option is currently false unless in production, but this seems to break importing predefined styles.

Should it be true?

In the meantime if you are trying to include styles from an npm module (i.e. bootstrap) do the following:

  1. create app/javascript/packs/styles.js file and import the style sheets you want.
  2. add <%= style_sheet_pack_tag 'styles' %> to your layout files.
  3. set extract_css: true in config/webpacker.yml

Currently trying to find an answer to why this is all necessary here: https://stackoverflow.com/questions/59009216/how-to-get-webpacker-to-load-css-if-extract-css-is-false

catmando commented 4 years ago

See the answer on the SO site.

Note sure if everything works quite, right, but the basic answer is that you want to have both <%= style_sheet_pack_tag 'xxxx' %> AND <%= javascript_pack_tag 'xxx' %> In development the stylesheet pack tag will do nothing, and the style sheets will be injected via the javascript_pack_tag. During production the stylesheet will get its own package...

Its all to make hot loading via webpacker work.

Need to test to see if hyper-spec works with all this...

catmando commented 4 years ago

to get things to work with hyper-spec you need to do two things:

  1. add extract_css: true under the test heading in the webpacker.yml file
  2. use the option layout: 'application' in the test spec (you can do it in before(:each) for example.)

We should try and see what happens if you directly use <%= javascript_pack_tag ... %> in side hyperspec component controller...