meanjs / generator-meanjs

MEAN.JS Official Yeoman Generator

Home Page:http://meanjs.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Where does cssFiles and jsFiles come from?

cainaf opened this issue · comments

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 %}

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

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

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.

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.

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 %}