-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Webpack style loader's insert option needs a different way to reference functions. Also deprecate webpack-helpers module.
- Loading branch information
Showing
3 changed files
with
17 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function style_inserter(el) { | ||
// Insert element at the top of <head> | ||
// Used for injecting CSS via webpack before any other CSS | ||
var first_child = document.head.querySelectorAll("*")[0]; | ||
if (first_child) { | ||
document.head.insertBefore(el, first_child); | ||
} else { | ||
document.head.append(el); | ||
} | ||
} | ||
|
||
module.exports = style_inserter; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,7 @@ | ||
function top_head_insert(el) { | ||
// Insert element at the top of <head> | ||
// Used for injecting CSS via webpack before any other CSS | ||
// Note: | ||
// Keep code compatible with IE11 as long as we support it. | ||
var first_child = document.head.querySelectorAll("*")[0]; | ||
if (first_child) { | ||
document.head.insertBefore(el, first_child); | ||
} else { | ||
document.head.append(el); | ||
} | ||
} | ||
// BBB | ||
// TODO: Remove in next major version. | ||
const style_inserter = require("./style-inserter"); | ||
|
||
module.exports = { | ||
top_head_insert: top_head_insert, | ||
top_head_insert: style_inserter, | ||
}; |
This file contains 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