Giter VIP home page Giter VIP logo

puli.js's Introduction

Puli Javascript reader for automation tools

Build Status Build status

puli.js on npm

puli.js provides a Javascript, read-only API to 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

Usage

The PHP 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('/your/project/root/.puli/path-mappings.json', '/your/project/root');

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

Or using ES6 and Gulp:

// ...

import Puli from 'puli';

gulp.task('babel', ['lint'], () => {
    // Assuming your Gulpfile is at the root of your project
    let repository = Puli.load(__dirname + '/.puli/path-mappings.json', __dirname);

    gulp.src(repository.paths('/my/es6/resources/**/*.js'))
        .pipe(plumber())
        .pipe(babel({ sourceRoot: repository.path('/my/es6/resources') }))
        .pipe(gulp.dest(repository.path('/my/dist')));
});

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 run npm run watch to compile your files live ;
  • the source code is located in src and tests are located in test : theses two directories are compiled by Gulp respectively to dist and test-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 [email protected] or [email protected] or shout out to @titouangalopin or @webmozart on Twitter.

License

All contents of this package are licensed under the MIT license.

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.