Comments (7)
so when you run a plop generator... you want to type json into the console? I'm not sure I understand the want here.
from plop.
Sorry, I should have specified it better.
I'm expecting to load data from a json file which is "side-by-side" with templates.
I'm able to do it with yeoman, but I prefer the plop approach that keeps data and templates together with my source code.
from plop.
interesting feature, so this would allow you to have a template that renders differently depending on the json data that is next to it I guess?
plop doesn't currently support this, but it sound like it could be worth adding. π
from plop.
Happy to hear that you'll consider it!
A little bit more context: I'm a C# developer and I was convinced (and I proved it) that 60% of our code had patterns perfect for code generation or, if you wish, "continuous scaffolding".
I've defined a metadata small file and used Microsoft T4 to "continuously scaffold" entities (POCO objects), object mappers, data layer, (WCF) data services, etc.. When I find a bug, I can fix it in the template, regenerate the code and it's fixed everywhere (but it's also true the other way round you introduce a bug everywhere..). Partial classes in C# allow me to extend the generated part with custom code.
As we're moving to REST APIs I'd like to do the same but outside Visual Studio/pure .NET world, and I've started using yeoman.
Yeoman is anyway limited (I can't "nest" templates) and it's also hard to make it work in a "continuous" way. That's how I've found plop.
What I'm missing in Plop too is the possibility to get data "statically" (from a Json file, instead of prompting the user) and also the possibility to "nest" templates.
An example of nested template is the definition of a C# class: one template defines the class using the relative object, but internally I will use one or more property templates to generate the array of properties defined. That's what I mean for "data flowing from one generator to another".
I hope it helps and I would be glad to help if possible.
from plop.
I see, it sounds like what you want to do could be pretty easily achieved with node-plop once I finish it. I've got a version that's pretty close to ready, but not quite there yet. It basically take the core functions of plop, and makes them usable from a node script. So you should be able to code up something like what you want to do in a custom node script and let node-plop take care of the heavy lifting. I'll let you know once I have the first version up.
from plop.
Sounds very powerful.. Thanks!
from plop.
please take a look at node-plop. It's available now, not well documented, but I'd consider it pretty stable at this point.
from plop.
Related Issues (20)
- Plop "ignore syntax" not functional for Github Actions Secrets HOT 2
- Generators do not work with plop.load() HOT 4
- Support multiple component generation in one go using whitespaces as a delimiter
- Plop does not handle `| null` when adding lines HOT 1
- Feature request: ability to use `select` prompt from Inquirer HOT 2
- Rewrite to use new Inquirer Packages HOT 1
- Plop is not a function HOT 2
- SyntaxError: Identifier 'require' has already been declared HOT 1
- No plopfile found! - message after compilation in procedural script HOT 2
- [node-plop] Support ESM configs HOT 4
- Helpers in Template Files HOT 1
- feat: make it possible to disable the progress spinner HOT 1
- Loaded plopfiles do not respect the `--force` flag HOT 6
- Plop 4 Planning HOT 6
- Set `dest` dynamically within a monorepo (workspace) environment HOT 6
- Add configuration option for custom handlebar delimiters HOT 3
- [node-plop] instanceof Array is not working with array from vm script
- Action `type: "modify"`'s `pattern` property should be built as a Handlebars template HOT 1
- node v14οΌIntl.Segmenter is not a constructor HOT 1
- titleCase fails to transform name HOT 2
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 plop.