Skip to content

Loading…

Serve CSS bundle at end of HEAD tag by default #294

Open
extesy opened this Issue · 9 comments

7 participants

@extesy

The default bundler will add the CSS tags to the end of the HEAD tag. If you want the original behaviour, set client options.cssWithJavaScript = true.

###Original:
Currently SocketStream puts all templates (compiled or not) into the head tag. Server-compiled templates are simple javascripts after all, so it just makes sense to serve them as a javascript file. So SocketStream should be able to serve templates via separate file, something like "/_serveDev/templates?ts=1234567890" and include them in the packed javascript assets in production environment.

@owenb

Hmm we can do. It would have to be sent before any scripts which use templates, but that is doable.

Any particular reason you don't like the code in the head tag?

@sveisvei

In the usecase of having both express and ss at the same time, and reusing some of the ss templates, it might make sense to have this option.

@owenb

Agreed. Spoke about this on the newsgroup too. For 0.4 I'd like any dom elements to output to the HTML view and all other code to go into a seperate JS file, auto loaded before everything else, and then packed into the same main .js file as everything else.

@luksch

any chance of having this any time soon?

@paulbjensen
SocketStream member

Sadly I'm not able to do that right now. If I could work on SocketStream as part of my job, that would be great, but sadly I'm doing more of a sysadmin/full-stack dev/qa job at the moment.

@RomanMinkin

Hey folks,

From the other hand in some cases header <script> templates needed for third party plugins as angular-ui/bootstrap, where templates calls hardcoded as

templateUrl: 'template/accordion/accordion.html'

It's why I came up with ss-angular-templates module for SocketStream.

@thepian

This can be done as a plugin. I would suggest to treat this a Documentation Request

@paulbjensen
SocketStream member

@thepian is this something that can be done for 0.3.12, or would depend on a major update (i.e. 0.4).

@thepian

With 0.4 you should be able to make a modified bundler that does what you want. But I suppose we could still have a look at supporting more options for bundling templates.

On a project I work on we bundle Angular templates in a javascript and serve them with the code. Although it felt strange to me at first, I must admit that it has few drawbacks I can think of.

So I'd like to see more options around template bundling.

@thepian thepian added this to the 0.4.x milestone
@thepian thepian changed the title from Serve compiled templates as a separate javascript file instead of a head tag to Serve CSS bundle at end of HEAD tag by default
@thepian thepian modified the milestone: 0.6, 0.4.x
@thepian thepian modified the milestone: 0.7.0 unstable, 0.6 stable
@thepian thepian added New Feature and removed Feature Request labels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.