Skip to content

webpack plugin that pre-annotates your angular files so you can minify them.

Notifications You must be signed in to change notification settings

jeffling/ngmin-webpack-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deprecated for the most part

ngmin is no longer the best dependency annotator to use. btford recommends using ng-annotate. of course, there's a plugin for that right here: https://github.com/jeffling/ng-annotate-webpack-plugin.

That being said, if you have to use ngmin, and you se a bug, feel free to make an issue and I'll try my best to help.

ngmin-webpack-plugin

Runs the ngmin pre-minimizer to insert AngularJS DI annotations, so instead of writing

angular.module('whatever')
.controller('MyCtrl', ['$scope', '$http', 
  function ($scope, $http) { ... }]);

you can write

angular.module('whatever')
.controller('MyCtrl', function ($scope, $http) { ... });

Usage

In your webpack config:

var ngminPlugin = require("ngmin-webpack-plugin");

module.exports = {
  // your config and junk
  plugins: [
    new ngminPlugin() // or, new ngminPlugin({dynamic: true}) for dynamic mode.
  ]
}

As a more realistic example, if you're running webpack from a script (like gulp or grunt):

var webpack = require("webpack");
var ngminPlugin = require("ngmin-webpack-plugin");
var webpackConfig = require("./webpack.config.js");
var argv = require("minimist")(process.argv.slice(2));

// --production option
if (argv.production) {  
  webpackConfig.plugins = webpackConfig.plugins.concat(new ngminPlugin(), new webpack.optimize.UglifyJsPlugin());
  webpackConfig.devtool = false;
}

webpack webpackConfig, (err, stats) ->
  if (err)
    throw err
  console.log stats.toString

About

webpack plugin that pre-annotates your angular files so you can minify them.

Resources

Stars

Watchers

Forks

Packages

No packages published