webpack-angular-resource-plugin

0.0.4 • Public • Published

webpack-angular-resource-plugin

Require all AngularJS modules for a Webpack project and return an array of the module names that can be used as dependencies of the main module. Can also batch require other resources such as style sheets and images.

Installation

npm install webpack-angular-resource-plugin --save-dev

Usage Example

In the entry point where the main angular module is defined, such as index.js or app.js, require the plugin:

var angularResourceUtil = require('webpack-angular-resource-plugin');

Require all css files under the current directory and its subdirectories:

var styleContext = require.context(".", true, /.css$/);

angularResourceUtil.requireAll(styleContext);

Define the main Angular module. Also require all files whose name end with .controller.js which contain submodules. Notice that the module names are returned as an array and passed to the factory method as dependencies of the main module:

var controllerContext = require.context('.', true, /\.controller\.js$/)

export default angular.module('app', angularResourceUtil.requireAll(controllerContext));

To run the tests for this plugin, execute the following command from the terminal at the root directory of the plugin: npm test

License

MIT (http://www.opensource.org/licenses/mit-license.php)

Package Sidebar

Install

npm i webpack-angular-resource-plugin

Weekly Downloads

2

Version

0.0.4

License

MIT

Last publish

Collaborators

  • liyutech