1.0.0 • Published 6 months ago

grunt-ps-transform v1.0.0

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
-
Last release
6 months ago

grunt-ps-tranform

This plugin transforms a file by inserting its contents in to a template provided as part of configuration options

Getting Started

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-contrib-uglify --save-dev

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

grunt.loadNpmTasks('grunt-contrib-uglify');

Transform task

Run this task with the grunt psTransform command.

Task targets, files and options may be specified according to the grunt Configuring tasks guide.

Options

OptionReplacement
templateTemplate string
genDestPathFunction that generates destination path
genModuleNameFunction that generates module name
PreProcessContentFunction that preprocesses content
genUIDFunction that generates unique id

Usage examples

Basic compression

This configuration will compress and mangle the input files using the default options.

// Project configuration.

function genTemplate() {
  // returns template string
}

function genDestPath(filePath) {
  // returns destination path
}

function genModuleName(filePath) {
  // returns module name
}

function preProcessContent(content) {
  // returns processed file content
}

function genUID() {
  // returns unique id
}

grunt.initConfig({
  psTransform: {
    my_target: {
      options: {
        template: genTemplate(),
        genDestPath: genDestPath,
        genModuleName: genModuleName,
        preProcessContent: preProcessContent,
        genUID: function (filePath) {
            return genUID(appName, buFo, filePath);
        }
      },

      files: [{
          expand: true,
          src: ["path/*.css"],
      }]
    }
  }
});
1.0.0

6 months ago

0.0.6

2 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago