![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Add layout and partial support to consolidate.js!
This project was insprired by all the small projects which wraps a single template engine
to
integratate these into the express. Many of them exists only because they
add the missing layout and partial support which is not provided by
consolidate.js.
In many cases this is also fine because the most template engines includes already a simple
extend
and include
mechanism. If not, or if you are interessted in mixing your templates
give this project a try.
Comprise add layout and partial support to the great consolidate.js template engine. Means in general that all template engines which could call functions from the template ifself profits from the following functions:
Tested with:
Doesn't work yet with:
! layout('default')
and != partial('partial1')
does not work. Support welcome!{{{ layout 'default' }}}
and {{ partial("partial1") }}
does not work. Support welcome!var Comprise = require('comprise').Comprise;
var comprise = new Comprise({
engine: 'jade',
layout: 'default',
templateDir: __dirname + '/views'
});
comprise.render('your jade file', { user: user }, function(err, result) {
if (err) {
console.error(err);
} else {
console.log(result);
}
});
Available options:
engine
- See consolidate.js engine listlayout
- Optional default layoutextension
- file name extension, default is simular to engine
templateDir
- RequiredlayoutDir
- Optional, default is $templateDir/_layout
partialDir
- Optional, default is $templateDir/_partials
var comprise = require('comprise');
app.engine('jade', comprise.express({
engine: 'jade',
layout: 'default'
}));
app.set('view engine', 'jade');
Available options see API section above.
templateDir
was automatically set based on the
express setting views
(default ./views
).
Just render content.jade
, but use the common default.jade
template which extends the layout.jade
.
content.jade
template:
h1 This content use the standard layout!
div
!= partial('partial1')
div
!= partial('partial2.jade')
layout.jade
layout:
html
head
title comprise
body
!= content()
default.jade
included layout:
= layout('layout')
header
nav navigation code
!= content()
Comprise provides a simple wrapper around consolidate.js and add four small functions to the local template variables:
layout(layout)
adds a layout to the current template. Each call adds one to the layout hierachy. To replace a default layout call nolayout first.nolayout()
removes a default layout for the current template. You could set another layout with layout.content()
need to be called in a layout to insert the surrounded template.partial(partialTemplate[, partialVariables])
could be used to include other templates. In the common case the partial template name don't need a file extension. If a extension is provided a different engine could be used.npm install comprise --production
npm install --save-dev
npm test
# For code coverage
npm run-script coverjs; open cover_html/index.html
npm run-script istanbul; open coverage/lcov-report/index.html
FAQs
Add layout and partial support to consolidate.js!
The npm package comprise receives a total of 2 weekly downloads. As such, comprise popularity was classified as not popular.
We found that comprise demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.