forked from tyt2y3/F.core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcss.js
More file actions
29 lines (28 loc) · 824 Bytes
/
Copy pathcss.js
File metadata and controls
29 lines (28 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*\
* css
* css is a requirejs plugin that loads a css file and inject it into a page.
*
* note that this loader will return immediately,
* regardless of whether the browser had finished parsing the stylesheet.
*
* this css loader is implemented for file optimization and depedency managment
| requirejs(['css!style.css','css!more.css'],function(css1,css2){
| console.log(css1+','+css2); //true if successfully loaded
| });
\*/
define({
load: function (name, require, load, config) {
function inject(filename)
{
var head = document.getElementsByTagName('head')[0];
var link = document.createElement('link');
link.href = filename;
link.rel = 'stylesheet';
link.type = 'text/css';
head.appendChild(link);
}
inject(requirejs.toUrl(name));
load(true);
},
pluginBuilder: './css-build'
});