On the advice of A moderately Stoned Duck from my question on Assembling individual css and scripts into common files decided to try glob to crawl directories and include templates as points log in (yes, it probably looks strange). What you will learn:- How to use Pug (Jade) templates with Webpack 2Note: if you are having issues with pug-html-loader try also pug-loader. Source scripts and styles should be specified directly in Pug. Highlights: The Pug file is the entry point for all scripts and styles. I also need the collector to go through all the directories recursively and leave the converted file in the source location. The Pug plugin enable to specify Pug files in webpack entry and generates HTML file that includes the hashed output JS and CSS filenames whose source files are used in the Pug template. The problem I'm having is in getting pug-loader to render html into the files. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any resource or asset. In the documentation of the webpack, quite a bit is written about working with preprocessors templates and their operation requires explicit import. I'm trying to output individual html files from pug templates in my webpack project. All JSTransformer modules can be used as Pug filters. To pass options to the filter, add them inside parentheses after the filter name (just as you would do with tag attributes ): :less (ieCompatfalse). Learn how to use pug-html-loader by viewing and forking example apps that make use of pug-html-loader on CodeSandbox. They take a block of plain text as an input. The folder of each application contains a different number of templates: ├── appĪccordingly, their explicit import can be inconvenient. Filters let you use other languages in Pug templates. html-loader Exports HTML as string, require references to static resources pug-loader Loads Pug and Jade templates and returns a function. The project contains templates, styles, scripts for each application, which are located in a separate directory. How can I convert pug files into html templates without explicitly importing them to the entry point?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |