1.0.1 • Published 7 years ago

nitro-exporter v1.0.1

Weekly downloads
54
License
MIT
Repository
github
Last release
7 years ago

nitro-exporter

With this package, Nitro can generate static exports of your project by using npm run export.

$ npm run export

The exporter configuration can be found in config.json.

Configuration options

exporter.dest (String)

The distribution folder for your static export. This is where all your static files will go.

  • example: "dist"

exporter.i18n (Array)

Contains a list of language keys. The views will be exported using the specified language keys. You have to specify all languages addiotionally for the dump-views task at generator-nitro. The nitro-exporter will export all dumped views per default. You can filter out specific view exports by either setting i18n or views option.

  • example: ["de"]

exporter.publics (Boolean / Array)

Controls which public files should be exported statically. true will export all files from your public directory.

You can define an array of strings, like ["build/assets/css/app.css", "build/assets/js/app.js"] to export only those files.

When defining strings you can use globbing patterns.

  • example: true

exporter.renames (Array)

Defines file renames. Takes an array of objects with src, base and dest. Renaming is used with native gulp.src(...).pipe(gulp.dest(...)).

  • example:

      [{
          "src": "dist/assets/**",
          "base": "dist/assets",
          "dest": "dist/"
      }]

exporter.replacements (Array)

Defines string replacements. Takes an array of objects with glob and replace. replace is an array of objects with keys from and to.

Please note: renames are executed before replacements!

  • example:

      [{
          "glob": ["dist/*.html", "dist/css/*.css"],
          "replace": [{
              "from": "/assets",
              "to": ""
          }]
      }]

exporter.views (Boolean / Array)

Controls which views should be exported statically. true will export all views from your views directory.

You can define an array of strings, like ["index.hbs", "404.hbs"] to export only those views.

When defining strings you can use globbing patterns.

  • example: true

exporter.zip

Defines, if the export should be zipped.

  • example: false

Example Exporter Config

"exporter": {
    "dest": "dist",
    "i18n": [],
    "publics": true,
    "renames": [
        {
            "src": "dist/assets/**",
            "base": "dist/assets",
            "dest": "dist/"
        }
    ],
    "replacements": [
        {
            "glob": ["dist/*.html", "dist/css/*.css"],
            "replace": [
                {
                    "from": "/assets/",
                    "to": ""
                }
            ]
        },
        {
            "glob": ["dist/js/*.js"],
            "replace": [
                {
                    "from": "/api",
                    "to": "api"
                }
            ]
        },
        {
            "glob": ["dist/*.html"],
            "replace": [
                {
                    "from": "([a-z]+)\\.(css|js)",
                    "to": "$1.min.$2"
                }
            ]
        }
    ],
    "views": true,
    "zip": false
}

Multiple Exporter configurations

You can define multiple exporter configuration objects, by setting the exporter to an array.

Example

"exporter": [{
    "dest": "dist",
    "i18n": [],
    "publics": true,
    "renames": [],
    "replacements": [],
    "views": true,
    "zip": false
}, {
    "dest": "static",
    "i18n": [],
    "publics": true,
    "renames": [],
    "replacements": [],
    "views": true,
    "zip": false
}]
1.0.1

7 years ago

1.0.0

7 years ago

0.3.3

7 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago