GithubHelp home page GithubHelp logo

web5design / grunt-preprocess Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jsoverson/grunt-preprocess

0.0 3.0 0.0 152 KB

Preprocess files based off environment configuration

License: Other

grunt-preprocess's Introduction

grunt-preprocess Build Status

Grunt task around preprocess npm module

What does it look like?

<head>
  <title>Your App

  <!-- @if NODE_ENV='production' -->
  <script src="some/production/lib/like/analytics.js"></script>
  <!-- @endif -->

</head>
<body>
  <!-- @ifdef DEBUG -->
  <h1>Debugging mode - <!-- @echo RELEASE_TAG --> </h1>
  <!-- @endif -->
  <p>
  <!-- @include welcome_message.txt -->
  </p>
</body>
var configValue = '/* @echo FOO */' || 'default value';

// @ifdef DEBUG
someDebuggingCall()
// @endif

See preprocess documentation for more information

Getting Started

Install this grunt plugin next to your project's Gruntfile with: npm install --save-dev grunt-preprocess

Then add this line to your project's Gruntfile:

grunt.loadNpmTasks('grunt-preprocess');

Options

inline

Type: Boolean Default: `undefined

Required to enable overwriting of source files

context

Type: Object Default: {}

The additional context on top of ENV that should be passed to templates

Example Usage

preprocess : {
  options: {
    context : {
      DEBUG: true
    }
  },
  html : {
    src : 'test/test.html',
    dest : 'test/test.processed.html'
  },
  multifile : {
    files : {
      'test/test.processed.html' : 'test/test.html',
      'test/test.processed.js'   : 'test/test.js'
    }
  },
  inline : {
    src : [ 'processed/**/*.js' ],
    options: {
      inline : true,
      context : {
        DEBUG: false
      }
    }
  },
  js : {
    src : 'test/test.js',
    dest : 'test/test.processed.js'
  }
}

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.

Release History

  • 3.0.1 Fixed issue arising from undefinedd options (#19)
  • 3.0.0 Updated dependencies, added merge from global options context to subtask context (#13)
  • 2.3.0 Updated preprocess, changes default handling to html
  • 2.2.0 Delegating to grunt's file.read/write for consistent usage within grunt (e.g. deep writes)
  • 2.1.0 updated preprocess dependency
  • 2.0.0 updated for grunt 0.4.0, moved context override to context option
  • 1.3.0 Moved logic to 'preprocess' npm module
  • 1.2.1 Added @include to include external files
  • 1.2.0 Added @include to include external files
  • 1.1.0 Added ability to process multiple destinations in a files block
  • 1.0.0 Changed syntax, added directives
  • 0.4.0 Added support for inline JS directives
  • 0.3.0 Added insert, extended context to all environment
  • 0.2.0 Added simple directive syntax
  • 0.1.0 Initial release

License

Copyright OneHealth Solutions, Inc

Written by Jarrod Overson

Licensed under the Apache 2.0 license.

grunt-preprocess's People

Contributors

jsoverson avatar steffenmllr avatar

Watchers

 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.