Comments (7)
Sorry for the delay.
You guys are right, I will implement in the next days a simple boolean flag to allow use of .html.
For the record, I chose to forbid the use of .html as a source, simply because I overwrote a lot of my source files during the developement of this module, and it made me precautious about it.
from nunjucks-cli.
This feature seems like it could be desirable under a flag, but what is your use case for it, @thijsvandien? It would seem to me like the reason to care about the extension is that your text editor is not highlighting the code correctly and that is easily configurable in your editor. Can you elaborate a bit on why you want this?
from nunjucks-cli.
I'm also voting for support of this feature: allow templates to have *.html extension.
Templates are HTML files with some extended syntax so, why not to let any editor immediately recognize it as HTML via extension?
My use case it npm script:
"scripts": {
"build-html": "nunjucks *.html -p src/html/ -o dist/",
...
}
There is no way that problem described in warning message can happen:
To avoid overwriting your templates, do not use html as file extension
from nunjucks-cli.
Also the example in Nunjucks official documentation uses html extension for templates:
{% extends "parent.html" %}
{% block left %}
This is the left side!
{% endblock %}
{% block right %}
This is the right side!
{% endblock %}
from nunjucks-cli.
Indeed, I am not a fan of custom extensions where there are acceptable standard ones. As @darklynx said, .html is semi-offical here. Source files being overwritten is an exceptional case, the guard for which has a disproportional impact on the happy path.
from nunjucks-cli.
I find the idea of @homosaur is really good: add a special cli flag to allow .html extension for templates. By default for inexperienced users the tool will refuse to accept templates under .html extension, however the more experienced users may enable this possibility and they were already warned by default behavior and warning message.
from nunjucks-cli.
Initially I was thinking of simply comparing the input folder to the output folder and not warning if they're distinct, since nothing can happen then. Having given it some more thought, I realize it may not be that easy when relative paths get involved. There is no such thing as the input folder and the output folder. Instead, the program would have to make a list of files that are going to be read and files that are going to be written, before actually doing so, and from that determine if there are going to be conflicts. As much as I'd like to keep the API minimal, the implementation simplicity of a flag has a strong edge here, unless there are other advantages to such preprocessing (caching?).
from nunjucks-cli.
Related Issues (13)
- env: node\r: No such file or directory HOT 11
- It simply doesn't load the file, even when gets its name properly
- Watch is not working properly
- Trouble moving from Grunt to Nunjucks CLI HOT 1
- Support JavaScript (.js) context files
- README Incorrect
- Can't reach subdirectories
- The "path" argument must be of type string. Received undefined
- also watch data files
- output file is empty on error in watch mode
- Macros are case sensitive
- Includes in partials don't seem to handle variables well
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 nunjucks-cli.