1.0.0 • Published 4 years ago

parcel-plugin-sjt v1.0.0

Weekly downloads
-
License
GPL-3.0-or-later
Repository
gitlab
Last release
4 years ago

Parcel Plugin SJT

Description

What this plugin do: 1. transform .sjt template files to JSON object using environment variables 2. output a .js file that exports the previous JSON object

More about SJT files here.

Example:

src/demo.sjt input file :

{
    "abc": [
        {
            "$keepIf": "var1 is keepFirst",
            "$replaceByValue": "first"
        },
        {
            "$dropIf": "var1 is keepFirst",
            "$replaceByValue": "second"
        }
    ],
    "def": {
        "$replaceByVariable": "var2"
    }
}

build command:

var1=keepSecond var2=123 parcel build src/demo.sjt

outputing the result:

console.log(require('./dist/demo.js'))
{
    "abc": [
        "second"
    ],
    "def": "123"
}

About

author: Clément Saccoccio
contact: clem.saccoccio@protonmail.com
licence: GPL-3.0-or-later

licence