puli.js : the Puli Javascript reader
puli.js provides a Javascript, read-only API for transform Puli path into filesystem paths using a JSON file generated by the PHP JsonRepository.
puli.js is a first step towards creating plugins for automation tools such as Gulp, Grunt or Webpack.
This library is maintained for NodeJS 0.12+.
Authors
- Titouan Galopin aka @titouangalopin
- The Community Contributors
Usage
The JsonRepository generates a JSON file to store its path mappings (usually
/your/project/root/.puli/path-mappings.json
). This file is used by puli.js to transform Puli
paths into filesystem paths.
var puli = require('puli').load('.puli/path-mappings.json')
puli.path('/res/foo'); // returns the filesystem path associated to the virtual path /app/foo
puli.paths('/res/**/*.js'); // find matching virtual paths and return associated filesystem paths as an array
puli.exists('/res/**/*.js'); // check if the given virtual path exists or if the given glob contain paths
puli.js provides a read-only API: you cannot edit the path-mappings using it.
Documentation
Read the Puli Documentation to learn more about Puli.
Contribute
Contributions to Puli are always welcome!
Report bugs
You can report any bugs or issues you find on the issue tracker.
Pull requests
If you want to contribute on the code, here are some informations:
- puli.js is developed using ES6 ;
- we use Babel and Grunt to compile to ES5: to compile yourself, you can either run
npm run babel
to compile one time or runnpm run watch
to compile your files live ; - the source code is located in
src
and tests are located intest
: theses two directories are compiled by Gulp respectively todist
andtest-dist
; - run
npm test
to launch the test suite (the tests use mocha) ;
Create an automation tool plugin using this library
If you are interested in creating an automation tool plugin (for Gulp, Grunt, Webpack, ...), don't hesitate to open an issue in the issue tracker to discuss it. You can also join us on Gitter.
Support
If you are having problems, send a mail to galopintitouan@gmail.com or bschussek@gmail.com or shout out to @titouangalopin or @webmozart on Twitter.
License
All contents of this package are licensed under the MIT license.