Created
February 14, 2017 01:21
-
-
Save xuecan/019471958409cf8a422938d4b91d759f to your computer and use it in GitHub Desktop.
A simple requirejs plugin for stylesheets injection.
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
| /*! | |
| Copyright (C) 2015-2017 Xue Can <xuecan@gmail.com> and contributors. | |
| Licensed under the MIT license: http://opensource.org/licenses/mit-license | |
| */ | |
| // requirejs-css.js - A simple requirejs plugin for stylesheets injection. | |
| define({ | |
| load: function (name, req, onload, config) { | |
| if (!config.isBuild) { | |
| var link = document.createElement("link"); | |
| link.type = "text/css"; | |
| link.rel = "stylesheet"; | |
| link.href = name; | |
| document.getElementsByTagName("head")[0].appendChild(link); | |
| } | |
| onload(name); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment