meanjs / generator-meanjs

MEAN.JS Official Yeoman Generator
http://meanjs.org/
473 stars 178 forks source link

Where does cssFiles and jsFiles come from? #231

Closed cainaf closed 8 years ago

cainaf commented 8 years ago

Sorry for the stupid question. Im new to node and cant figure out where those come from, as in:

<!-- Application CSS Files -->
  {% for cssFile in cssFiles %}<link rel="stylesheet" href="{{cssFile}}">{% endfor %}

...

<!--Application JavaScript Files-->
  {% for jsFile in jsFiles %}<script type="text/javascript" src="{{jsFile}}"></script>{% endfor %}
codydaig commented 8 years ago

Long story short, they come from here. There's a series of processes that it goes through before it's injected, but this is where it originates.

https://github.com/meanjs/mean/blob/master/config/assets/default.js

cainaf commented 8 years ago

Great! That also answered some other questions :) Thank you!

codydaig commented 8 years ago

:-D

jiffify commented 8 years ago

Continuing with stupid questions, how are the assets injected. is this src="{{jsFile}}" doubble bracket angular syntax, if yes, then how can it be parsed before loading angular ?

What am I missing here ?

Thanks in advance.

cainaf commented 8 years ago

Hi @jiffify, that double bracket is for handlebars, a html templating engine. It happens to have this same double bracket syntax for rendering javascript variables passed in as params. This rendering occurs server side, before it's served to the browser.

sockol commented 8 years ago

If you are trying to add some other type of asset into the tag, like font urls:

//in config/config.js
config.files.client.font = getGlobbedPaths(assets.client.lib.font, 'public/');
//in config/lib/express.js
app.locals.fontFiles = config.files.client.font;
//in config/assets/default.js
client: {
    lib: {
      //font includes
      font:[
        'http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,400,300,500,600,700&subset=latin,latin-ext'
      ],
//in /modules/core/server/views/layout.server.view.html, <header> tag
 {% for fontFile in fontFiles %}<link href="{{fontFile}}" rel="stylesheet">{% endfor %}