Skip to content

pgutkowski/template-url-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

template-url-loader for webpack

Replaces every "templateUrl: 'url'," in code with "template: require(./url)". It's allows You to bundle external directives and components which are not webpack ready (like AngularStrap)

Usage

Documentation: Using loaders

Examples

To use template-url-loader You can either declare it in webpack.config.js:

loaders: [
        { test: /\.js$/, loader: "template-url-loader" },
    ]},

or in import statement:

import package from 'template-url-loader!path/package.js';
//package contains Angular module declaring templateUrl.

###Passing path prefix

Paths declared as templateUrl may differ from relative path from declaring module to template file. To create proper require statement, You can pass path prefix as argument, as follows:

require("template-url-loader?../prefix/path!path/package.js");
//string between '?' and '!' ('../prefix/path') is prefix added to every replaced templateUrl in file.

You can find working example here

License

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published