Gong Yibo Gong Yibo - 7 months ago 135
HTML Question

MEAN JS - where is the main html file (index.html) located

I just started learning MEAN JS and I am trying to find the html file for the main page. However I only see home.client.view.html and header.clinet.view.html in the view folder.

From what I know is, usually there is a main html which holds all the information of the home page, and we can add links of CSS files and JS files in the main html file.

How can I add links of extra CSS files and JS files in MEAN JS since i cannot find the main html file?

Answer

The MEANJS top level page is located under server/app/views/layout.server.view.html and is where you set header meta tags. Most everthing else on the page is programmatically inserted by angular, such as links to CSS files and Javascript files.

Any of the CSS or Javascripts files under your server/public directly are automagically added to the page. If you wish to add other, third-party scripts or stylesheets, you do so by editing your server configuration file, located at config/env/all.js.

So for example, to add the angular version of the tinymce editor to your MEANJS site, you'd edit config/env/all.js by adding CSS to module.exports.assets.lib.css and references to the tinymce editor and its angular wrapper to module.exports.assets.lib.js.

You will need to restart your server (via the 'grunt' command) if you change this file while the server is running.

UPDATE

Using mean-cli@0.6.1 to scaffold a new mean project, the default "top-level" page is located under packages/custom/meanStarter/public/views/system where you will find two files:

  • header.html - which describes the layout of the default navbar
  • index.html - which lays out the content of the default page

Now, having said that, it should be noted that the "proper" way of configuring a mean server to display your own top-level homepage is to create a new mean package.

See the docs for further information.