Giter Site home page Giter Site logo

auton's Introduction

Auton - automated resource compiler

(for a quick start, see example/example.js. The code below is a simple example of how to define your own rules / chains)

this is very rudimentary and i'd like a more complicated example in here.

var auton    = require('./lib/auton'),
    Compiler = auton.Compiler,
    plugins  = auton.plugins,
    path     = require('path');

var compiler = new Compiler('build', 'htdocs', true); // true is whether or not watch mode is on

compiler.addRule(
  /.js$/,
  javascriptSave,
  [plugins.read, plugins.jshint, plugins.uglify, plugins.gzip, plugins.save]
);

compiler.start();


// decide what the filename of saved files should be
function javascriptSave(type, filePath) {
  var filename = path.basename(filePath, '.js'),
      dirname  = path.dirname(filePath),
      output   = dirname + "/" + filename;

  if (type === 'minified') {
    return output + ".min.js";
  }
  else if (type === 'compressed') {
    return output + ".min.js.gz";
  }
  else if (type === 'plain' || type === '__age_check__') {
    return output + ".js";
  }
  else {
    return null;
  }
}

this example will find all files ending with .js within the folder 'build', run them through jshint, uglify-js, and gzip, and save a non-minified, a minified, and a minified+gzipped version.

auton's People

Contributors

digiwano avatar adamghill avatar coderoshi avatar

Watchers

thezerobit avatar Tyler Spaeth avatar Nat avatar James Cloos avatar  avatar Judith Lebzelter avatar Anthony avatar Lochlan McIntosh avatar LF avatar  avatar Noz avatar Joshua Stacy avatar  avatar Mark avatar  avatar  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.