問題タブ [pug-loader]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
javascript - Can Webpack build multiple HTML files from SCSS and Pug?
I've read quite a few tutorials on webpack, but it seems more for creating web apps then for what I'm trying to do so I didn't want to waste any more time if the following isn't possible.
I'm creating websites on a third-party eCommerce system and they have a system of coding out templates that can be used to change the structure of their website. Below is an example of one of their templates I would be creating (although there are many types & variations I will need to make, not just a few).
My idea to streamline the creation of these templates is to create a bunch of pug components and place them in the components/ directory. Outside of the components directory I want to make higher level pug templates that utilize the components. Once these have been created, I would build it with NPM and the template files need to be converted to HTML and placed within the /dist folder.
Is this hard to do with webpack?
Structure of the project:
and once built:
Sample of a template:
gulp - gulpにすべてのファイルを同時に書き込む方法は?
すべての pug テンプレート (インクルード付き) を構築する gulp タスクがあります。
このタスクを実行するウォッチャーもあります。
現在、私は5つのパグテンプレートを内部に持ってsrc/
おり、パグがファイルを書き込むたびにdist/
(通常は2〜5秒かかります)、dist/
ブラウザーのリロードをトリガーするライブリロードを観察するため、5回のブラウザーのリロードを監視する必要があります。
すべてのファイルを同時に保存すれば、これを防ぐことができると思います。それはどのように達成できますか?(または、より良い解決策がある場合は、それらを提案してください)。
https://github.com/tapio/live-serverを使用する PS Live Reload 。