Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{{asset 'scripts'}} helper #3

Closed
daffl opened this issue Jun 9, 2015 · 4 comments
Closed

{{asset 'scripts'}} helper #3

daffl opened this issue Jun 9, 2015 · 4 comments

Comments

@daffl
Copy link
Contributor

daffl commented Jun 9, 2015

Currently there is only two asset helpers. When looking at the layout page, instead of having to add

{{#isProduction}}
    <script src="/node_modules/steal/steal.production.js" main="pmo/main.stache!done-autorender"></script>
    {{else}}
    <script src="/node_modules/steal/steal.js"></script>
{{/isProduction}}

Every time, could we just add an

{{asset 'scripts'}}

Helper that implements that logic (using require('package.json').main as the main for production)?

@daffl daffl changed the title {{assert 'scripts'}} helper {{asset 'scripts'}} helper Jun 9, 2015
@matthewp
Copy link
Contributor

Not a bad idea, maybe {{asset 'steal'}} would be better though since this is only about steal.

@matthewp
Copy link
Contributor

thinking about it a bit more this isn't really want {{asset}} is for. {{asset}} is for 3rd party libraries to create DOM elements that are associated with something that is loaded as part of the page lifecycle.

For example done-css registers styles using assetRegister(load.name, "css", callback) where callback is a function that gets called when load.name (a module) is part of the page lifecycle.

That being said, another helper that makes it easier to add the steal script tag is a good idea. Maybe something like:

{{steal cacheVersion=12}}

defaulting to node_modules/steal/steal.js in dev and node_modules/steal/steal.production.js in production.

@matthewp
Copy link
Contributor

matthewp commented Jun 1, 2017

We don't have the {{asset}} helper any more. But what done-ssr should do is add the appropriate script tags for you in production. It can consume the bundle graph that steal-tools will be exporting.

@matthewp
Copy link
Contributor

We don't have an asset helper any more. However #212 and #211 would do what we want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants