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

Concatenate js resource #56

Open
jeanlaurent opened this issue May 24, 2014 · 4 comments
Open

Concatenate js resource #56

jeanlaurent opened this issue May 24, 2014 · 4 comments

Comments

@jeanlaurent
Copy link
Member

When we have something like this

    <!-- concat:app.js-->
    <script src="/js/lib/jquery.min.js"></script>
    <script src="/js/lib/angular.min.js"></script>
    <script src="/js/lib/angular-route.min.js"></script>
    <script src="/js/lib/angularLocalStorage.js"></script>
    <script src="/js/lib/angular-cookies.min.js"></script>
    <script src="/js/lib/angular-animate.min.js"></script>
    <script src="/js/order.coffee"></script> <!-- only usefull for checkout -->
    <script src="/js/basket.coffee"></script>
    <script src="/js/webshop.coffee"></script>
   <!-- concat:end-->

we should concat in prod mode to

    <script src="/js/app.js"></script>

this can also be done for css.

@dgageot
Copy link
Member

dgageot commented Jan 10, 2015

The [[script]] and [[css]] handlebars helpers support a list of names. It could concatenate the resources and link to a sha1

@BodySplash
Copy link
Contributor

Would it be possible to support requirejs or browserify in addition or instead of this solution ? 

@dgageot
Copy link
Member

dgageot commented Feb 9, 2015

Is there something that prevents you from using browserify right now?

@BodySplash
Copy link
Contributor

Not really. I can use browserify from the command line, and with a few scripts build my assets during continuous integration run. But it feels ankward to maintain several build scripts to package my application. I really don't know if it's possible, it's just an idea :) In my experience, js file concatenation is a less than ideal solution to package js assets : 

  • we can forget to add a script tag
  • in our js files, dependencies are never explicit, and we easily forget where a method or class comes from
  • it encourages to use global variables

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

3 participants