Closed yannisgu closed 7 years ago
Lovely, very clean. The only issue I have would be the source paths (since partials starting with a leading underscore are skipped by the main html task), I guess a custom config would be better here.
@backflip what do you propose? source/**/*.hbs
?
We probably have some templates we only use for assets (e.g. to generate scss files). I'd suggest the following:
'./source/*.hbs',
'./source/pages/**/*.hbs',
'./source/modules/**/*.hbs'
Hm, never mind, they have a different file ending: https://github.com/unic/estatico/blob/develop/source/assets/css/templates/_colors.scss
So the we could go for your suggestion. What I would add, however, is a base
option (https://github.com/unic/estatico/blob/develop/gulp/html/default.js#L70), gulp tends to do weird things otherwise.
I set a base
option: https://github.com/unic/estatico/pull/68/files#diff-b50f1a580a0d875c5e818d3af997e3acR14
Or should this be at another location?
I'm very good at reading. Everything perfect.
@backflip I changed the src and wrote some small comments. Ok?
@orioltf, any thoughts?
Well… I don't quite understand why are the hbs files needed to be exposed in assets… seems like an isomorphic-like approach? And another question: is this task something needed in every project?
As per the changes per se… I have no objection, the opposite: clean and to the target. ☺️
@orioltf actualy we (backend) simply need the hbs files somewhere in the /build folder, so that we grab them together with the assets and put them somewhere in our web-root, so that we are able to reference them from our code.
For us, assets is the simplest way, as we grab them already now. But if you feel, that e.g. build/templates
would fit better, that also works for us.
And no, not every project will need it I guess. But thats also true for many other estatico features. That's why I realy hope estatico will jump on a modular architecture anytime soon
Okay, last request: What if disable it by default by commenting out 'html:copy',
in gulp/build.js
? This would prevent unsuspecting users from ending up with handlebars files in their assets by accident. And you would just enable it in your projects.
@backflip added this
👏
We have implemented something similar. Two smaller annotations:
html:copy
is a confusing name, because no html is rendered or copied. We named it html:hbs:copy
- but not perfect as well. Maybe someone has a better idea?
The destination assets
should be for frontend assets only (and the directory name html
is confusing again). I'd recommend a different destination, e.g. build/hbs/
Regarding the naming, what about hbs:copy
?
Regarding the destination: what about build/templates
?
html:
as Prefix is coming from the directory structure gulp/html
. (Another possibility could be to move everything to gulp/hbs
and have a render
and a copy
task there. But not sure if I like that approach more.)
build/templates
as destination sounds good 👍 (Maybe build/templates/hbs
to stay specific enough)
Of course! I've totally overseen the prefix being the folder. Originally the folders contain the tasks to produce the product that a folder's name indicate. Your suggestion would actually introduce the opposite concept, which isn't bad and it may even be a more suitable approach to cover more cases.
I'd suggest then to name it html:his:copy
as well (if it is fine for @yannisgu and @backflip too). Then we can discuss about naming approaches in the new modular Estático (if that is even a topic in there, maybe not).
his
? what is this stanging for? :)
Sorry, that was a phone autocorrecting typo. I was meaning html:hbs:copy
.
Thanks, @yannisgu!
Created a html:copy task to have the handlebars templates as part of the assets. This task is handy when the backend developers directly call the handlebars templates to render the HTML.
Thoughts?