GithubHelp home page GithubHelp logo

isabella232 / nitro-exporter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from merkle-open/nitro-exporter

0.0 0.0 0.0 61 KB

An exporting package for nitro < 4. Generate static packages with ease.

License: MIT License

JavaScript 100.00%

nitro-exporter's Introduction

This package hasn't been under active development since about Mai 2018. It still works with nitro versions < 4.0.0.
For projects from Nitro Version 4, please use the new @nitro/exporter package.

nitro-exporter

With this package, Nitro < 4 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
}]

nitro-exporter's People

Contributors

ernscht avatar regaddi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.