Created
November 13, 2016 20:38
-
-
Save yjaaidi/fce2464826281d80207dd97277874881 to your computer and use it in GitHub Desktop.
Webpack Dynamic File Name Resolution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Webpack config | |
*/ | |
/* Use file-loader for images. */ | |
{ | |
test: /\.(gif|ico|jpg|png|svg)$/, | |
loader: 'file' | |
} | |
/* User file-loader for html files ending with 'async.html'. */ | |
{ | |
test: /\.async\.html$/, | |
loader: 'file' | |
} | |
/* | |
* Your js/ts code. | |
*/ | |
let logoUrl = require(`./logo-${companyId}.png`); | |
/* You can also customize your templates depending on some context variable. | |
* In this example we suppose we are using ionic or nativescript and we want to use different templates depending on the OS. */ | |
const os = 'ios'; | |
@Component({ | |
templateUrl: require(`./my-cool-button.${os}.component.async.html`) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment