2.2.3 • Published 2 years ago

ngs-template-pot2 v2.2.3

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

ngs-template-pot

NGS template used in pot to build webapps.
It contains tasks for:

  • build
  • test
  • serve

This version uses the following tools:

  • gulp@3.9.x
  • browserify@13.0.x
  • typescript@2.3.x

How to install

By default ngs will try to install it if the template is referenced in a package.json.
But if you want to install it because you already know you'll need it:

ngs install ngs-template-pot@1.0.0

Options

  • uglify: boolean (default: true)
  • cssSrcMap: boolean (to create source map files for CSS, default: false)
  • copyStyleguide: string (the name of the styleguide package, default: null)
  • copyHelp: boolean (to copy or not the help directory, default: false)

Tasks

copy

The copy task will copy to the dist:

  • app/menu.json
  • app/**/*.(png|jpg|jpeg|svg)
  • assets/**

How to overwrite a configuration

You must create a ngsconfig.js file at the root of your project like this:

module.exports = (name, config) => {
  return {
    uglify: false,
    cssSrcMap: true,
    copyStyleguide: sicpa-styleguide-dark
  }
}

Proxy configuration

In the nsconfig.js, you can override the proxy configuration and proxy multiple paths to a specific target like this:

module.exports = (name, config) => {
    return {
        serve: {
            server: {
                port: 3000,
            },
            proxy: [
                {
                    path: '/api/',
                    target: 'http://host1:8080'
                }
                ,
                {
                    path: '/otherapi/',
                    target: 'http://host2:8088'
                },
            ]
        },
    };
};

For each task that use some configuration, this method will be called.
Then the returned object (if exists) is merged with the default configuration.
If you don't return anything, the default values are kept.
If you need to filter which configuration you change, use the name parameter.