pixelastic / norska

🏔️ Custom SSG using Pug, Webpack, PostCSS and Tailwind.
https://projects.pixelastic.com/norska/
MIT License
8 stars 0 forks source link

Should have a simpler default script.js #95

Closed pixelastic closed 3 years ago

pixelastic commented 3 years ago

The default script.js file should have the following code:

const theme = require('{theme}/script.js');
(async () => {
  await theme.init();
})();

This should be enough placeholder for every theme to initialize correctly. The {theme} part might need to be replaced with the current theme the same way do with CSS (this might be slighly harder as webpack expect a path, not a string, but we'll see).

If not possible, the theme documentation should include information about how to load the theme.

pixelastic commented 3 years ago

I've been needing that for both the search and docs theme. It's time I add it to the core

pixelastic commented 3 years ago

This is added through a custom webpack resolve alias. This still requires a norska update and a manual update of the src/script.js of: