css.js 688 B

1234567891011121314151617181920212223
  1. /** `css` is a requirejs plugin
  2. that loads a css file and inject it into a page.
  3. note that this loader will return immediately,
  4. regardless of whether the browser had finished parsing the stylesheet.
  5. this css loader is implemented for file optimization and depedency managment
  6. */
  7. define({
  8. load: function (name, require, load, config) {
  9. function inject(filename)
  10. {
  11. var head = document.getElementsByTagName('head')[0];
  12. var link = document.createElement('link');
  13. link.href = filename;
  14. link.rel = 'stylesheet';
  15. link.type = 'text/css';
  16. head.appendChild(link);
  17. }
  18. inject(requirejs.toUrl(name));
  19. load(true);
  20. },
  21. pluginBuilder: '../vendor/require/css-build'
  22. });