unic / estatico

[DEPRECATED] Estático – Static site generator for frontend unicorns
Other
121 stars 18 forks source link

create html:copy task #68

Closed yannisgu closed 7 years ago

yannisgu commented 7 years ago

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?

backflip commented 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.

yannisgu commented 7 years ago

@backflip what do you propose? source/**/*.hbs?

backflip commented 7 years ago

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'
backflip commented 7 years ago

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.

yannisgu commented 7 years ago

I set a base option: https://github.com/unic/estatico/pull/68/files#diff-b50f1a580a0d875c5e818d3af997e3acR14

Or should this be at another location?

backflip commented 7 years ago

I'm very good at reading. Everything perfect.

yannisgu commented 7 years ago

@backflip I changed the src and wrote some small comments. Ok?

backflip commented 7 years ago

@orioltf, any thoughts?

orioltf commented 7 years ago

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. ☺️

yannisgu commented 7 years ago

@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

backflip commented 7 years ago

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.

yannisgu commented 7 years ago

@backflip added this

swey commented 7 years ago

👏

We have implemented something similar. Two smaller annotations:

orioltf commented 7 years ago

Regarding the naming, what about hbs:copy? Regarding the destination: what about build/templates?

swey commented 7 years ago

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)

orioltf commented 7 years ago

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).

yannisgu commented 7 years ago

his? what is this stanging for? :)

orioltf commented 7 years ago

Sorry, that was a phone autocorrecting typo. I was meaning html:hbs:copy.

backflip commented 7 years ago

Thanks, @yannisgu!