Comments (4)
if you want to use an extendable layout, so each page uses the same layout file, then you can try actual html-bundler-webpack-plugin. This plugin allow very easy to configure the webpack to render handlebars
(and many other template engines).
Here is the webpack-starter-with-handlebars with the example exactly for your use case.
For example, there is the layout.hbs
:
The page file index.hbs
:
The webpack config is very easy:
new HtmlBundlerPlugin({
// automatically processing all pages from the directory
entry: Path.join(__dirname, 'src/views/pages/'),
// - OR - define each page manually
entry: {
'de': 'src/views/pages/de.hbs', // => dist/de.html
'en': 'src/views/pages/en.hbs', // => dist/en.html
// etc.
},
preprocessor: 'handlebars',
preprocessorOptions: {
partials: [
'src/views/partials/',
],
},
js: {
filename: 'js/[name].[contenthash:8].js',
},
css: {
filename: 'css/[name].[contenthash:8].css',
},
}),
P.S. you can create a small repo with your use case and I can help you to configure it.
from handlebars-layouts.
Wow @webdiscus thanks very much for the details, It very much helps. I'll try to see what I can do, and let you know &/ close this issue. Thanks much for the help, you definitely gained a star!
from handlebars-layouts.
@Paillat-dev if you have any questions create a discussion or an issue.
from handlebars-layouts.
If anyone happens to come here and read this, just use the solution above :)
from handlebars-layouts.
Related Issues (20)
- [object Object] when using {{#content}} HOT 3
- Dynamically load partials, aka `res.render` HOT 2
- zuul, travis, and sauce not playing nice HOT 1
- Extending block pollute each others output HOT 3
- Upgrade jade to pug HOT 1
- It only shows the path to the partial HOT 2
- Trying to get this to work with Express HOT 5
- Handlebars-layouts and Webpack HOT 2
- ReferenceError: Handlebars is not defined HOT 3
- Default "mode" HOT 3
- Append HOT 2
- Error working with Html-webpack-plugin HOT 5
- Example of using it with express-handlebars HOT 1
- Extending partial causes error (handlebars.compile is not a function) HOT 1
- Error: missing partial: 'html/template'
- Conditional layout HOT 3
- Unexpected whitespace from `{{#content}}` block HOT 2
- block is unable to render when being wrapped by an each loop HOT 2
- is there a way to use inline partials? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from handlebars-layouts.