-
Notifications
You must be signed in to change notification settings - Fork 27
Loading custom js css files
azproduction edited this page Jan 28, 2013
·
1 revision
- Flags:
js
,css
,race
You can enable flags css: true
and js: true
to use css and js loader as all loaders do. (Disabled by default)
Note
- If you are performing parallel loading of the same resource add
race: true
(Disabled by default) flag to prevent duplication of requests.
// require some off-package javascript file - not a lmd module. Config flag: `js: true`
require.js('./vendors/jquery.someplugin.js', function (scriptTag) {
console.log(typeof scriptTag === "undefined" ? 'error' : 'js loaded');
});
// require some off-package css file. Config flag: `css: true`
require.css('./css/b-template.css', function (linkTag) {
console.log(typeof linkTag === "undefined" ? 'error' : 'css loaded');
})