vabruzzo / parcel-plugin-ejs Goto Github PK
View Code? Open in Web Editor NEWa parcel plugin for ejs templates
License: MIT License
a parcel plugin for ejs templates
License: MIT License
Hello,
I'm trying to build an app with your transformer.
It works great if I put my local vars in .ejsrc (like in the readme)
But I'd like to set some local vars in javascript, because some of their values need to be computed, not hardcoded.
So I created an .ejsrc.js and tried to define a global object "locals" inside, but it doesn't work.
No luck with ejs.config.js either.
Ex: .ejsrc contains:
foo = 1;
locals = {
bar: 2
}
if my index.ejs contains:
What's the good way to set local vars in JS please?
Thanks a lot
Is there any documentation on how to use this with parcel? I installed it but my ejs files are not compiling blank.
Hello,
I just installed as requested the plugin by executing the command:
npm i -S parcel-plugin-ejs
Unfortunately my index.html file is empty.
Here's my script to start ParcelJS:
cross-env NODE_ENV=development parcel ./src/index.ejs
ejs templates are meant to be used with different render data, and when importing them, there is no way to pass render data.
I think it will be more useful to import the compiled template instead.
<button><% buttonText %></button>
import rendered from './template.ejs';
results in error: buttonText is not defined
With the same ejs file,
import template from './template.ejs';
const rendered = template({
buttonText: 'Click Me'
});
This change would be a matter of changing this line from return compiled();
to return compiled;
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.