Can I keep pug template in separate file?
See original GitHub issueLike this:
MyComponent/
MyComponent.pug
MyComponent.styl
MyComponent.js
MyComponent.pug:
div(class=`${styles.container}`)
p
= this.state.text
MyComponent.js:
import React from 'react';
import styles from './MyComponent.styl';
import template from './MyComponent.pug'; // raw text loader
class MyComponent extends React.Component {
render() {
return pug`${template}`;
}
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Template Inheritance - Pug
Pug's template inheritance is a powerful feature that allows you to split complex page template structures into smaller, simpler files. However, if you...
Read more >Rendering Pug Templates with Multiple Data Files
How to render your Pug templates from multiple data files using Gulp.
Read more >compiling pug templates to single client side js file
This will compile all the templates in the path/to/templates folder to a templates.js file in /path/to/output. Include the generated file in ...
Read more >Make multipage HTML development suck less with Pug
One of the most important features for pug is the partials. The idea is to have one file that holds most of your...
Read more >Pug HTML Template Engine: A Beginner's Guide - SitePoint
The template engine will normally receive data from an external ... Syntax highlighting will make it much easier to work with Pug files, ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ooops, it looks like I created a
react-pug
team, and added you to it, but forgot to add the repository. Should be fixed now 😃@mars-abd you can use this plugin https://github.com/bluewings/pug-as-jsx-loader/blob/master/README.md#import-pug-template