JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q19430F
  • License ISC

Consolidate and replicate JSON objects scattered throughout Javascript libraries via YAML templating.

Package Exports

  • gulp-jasyacon

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gulp-jasyacon) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Gulp JasYaCon

Note: This package is highly unstable and subject to backwards-incompatible changes

Occasionally we find ourselves with a lot of static JSON objects floating around our scripts, causing clutter and ugliness. JasYaCon (JSON YAML Consolidator) is able to convert a YAML file into a JSON object, and then place that object directly into your script wherever specified, allowing for cleaner code and extremely easy replication.

Arguments

  • (glob) yamlGlob - The glob containing all of the yaml files for processing.
  • (object) yamlArgs - These are passed directly into Yaml to Json. Please refer to that package's documentation.

Sample Use

First we have our yaml file. Let's say the full path is: ./src/yaml/Persons.yaml ```yaml

name: "John"
age: 23

name: "Sally"
age: 51
Now we have our javascript in which we want to import these people. Let's say the full path is ./src/js/myScript.js
```js
var ListOfPeople = /* !!jasyacon Persons */;

Finally, we have our gulpfile.js

var jasyacon = require('gulp-jasyacon'),
    gulp = require('gulp');

gulp.task("default", function() {
  gulp.src(['./src/js/**/*.js'])
    .pipe(jasyacon({yamlGlob: './src/yaml/**/*.yaml'}))
    .pipe(gulp.dest('./public/'));
});

This will compile, creating a file with the path ./public/myScript.js That file will look like this:

var ListOfPeople = [{"name": "John", "age": 22},{"name": "Sally", "age", 51}];

Plugins

gulp-jasyacon utilizes the following plugins: