chikamichi / mgeco

MG ECO SAS
http://mg-ecoconstruction.com/
0 stars 0 forks source link

Inject thumbnails' width in gallery.js template #66

Open chikamichi opened 6 years ago

chikamichi commented 6 years ago

We'd like for the CSS to control the layout all the way down to JS-powered generated content, like galerie.html.

Right now, CSS (Sass) dimensions are duplicated in generators/src/_utils/settings.js, then required from generators/src/gallery/index.js (and others).

We'd like to reuse Sass variables to dynamically compute the appropriate thumbnails' width, but we cannot do that client-side as there are no more .scss files to parse (only CSS), no support for CSS module and no way to use node-sass anyway. It simply can't be done with gallery/index.js -> galerie.html.

Therefore, gallery/index.js should be fed with a hard-coded, pre-computed value for the thumbnails' width.

In order to do so, Webpack should:

The resulting JS file then may be required by gallery/index.js (and others), not minding whether code is running server-side or client-side.