0.2.0 • Published 9 years ago

grunt-image-jsx v0.2.0

Weekly downloads
1
License
-
Repository
github
Last release
9 years ago

NPM GitHub Travis CI

grunt-image-jsx

Run JSX scripts on image files

Getting Started

This plugin requires Grunt ~0.4.5

Only OS X is supported at the moment.

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-image-jsx --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-image-jsx');

The "imagejsx" task

The task calls a JSX file on every single image given as src. The task itself does not create a destination file, and does not modify existing files.

The destination file needs to be generated by the JSX script. Source and destination file are passed to the script as the first two arguments with their full paths.

For an example JSX file, see demo.jsx.

Overview

In your project's Gruntfile, add a section named imagejsx to the data object passed into grunt.initConfig().

grunt.initConfig({
  imagejsx: {
    options: {
      // Task-specific options go here.
      jsx: 'test/demo.jsx',
      debug: 'on runtime error'
    },
    your_target: {
      // Target-specific file lists and/or options go here.
    },
  },
});

Passing arguments to the JSX script

All additional arguments of the task will be passed to the JSX script, after the source and destination paths.

For example, a task named imagejsx:resize:800:600 will receive 4 arguments:

arguments[0] == '/full/path/to/source/file'
arguments[1] == '/full/path/to/destination/file'
arguments[2] == '800'
arguments[3] == '600'

Options

Required

jsx (String)

Path to the JSX file to execute on every source file.

Optional

debug (String)
  • Default value: 'on runtime error'
  • Other possible values: 'never', 'before running'
0.2.0

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.0

9 years ago