diff --git a/lib/addStyles.js b/lib/addStyles.js
index b7b07749..c0767b01 100644
--- a/lib/addStyles.js
+++ b/lib/addStyles.js
@@ -201,7 +201,9 @@ function removeStyleElement (style) {
function createStyleElement (options) {
var style = document.createElement("style");
- options.attrs.type = "text/css";
+ if(options.attrs.type === undefined) {
+ options.attrs.type = "text/css";
+ }
addAttrs(style, options.attrs);
insertStyleElement(options, style);
@@ -212,7 +214,9 @@ function createStyleElement (options) {
function createLinkElement (options) {
var link = document.createElement("link");
- options.attrs.type = "text/css";
+ if(options.attrs.type === undefined) {
+ options.attrs.type = "text/css";
+ }
options.attrs.rel = "stylesheet";
addAttrs(link, options.attrs);
diff --git a/test/basic.test.js b/test/basic.test.js
index 54c2bce9..3725e962 100644
--- a/test/basic.test.js
+++ b/test/basic.test.js
@@ -220,6 +220,26 @@ describe("basic tests", function() {
runCompilerTest(expected, done);
}); // it attrs
+ it("type attribute", function(done) {
+ // Setup
+ styleLoaderOptions.attrs = {type: 'text/less'};
+
+ fs.writeFileSync(
+ rootDir + "main.js",
+ [
+ "var a = require('./style.css');"
+ ].join("\n")
+ );
+
+ // Run
+ let expected = [
+ existingStyle,
+ ``
+ ].join("\n");
+
+ runCompilerTest(expected, done);
+ }); // it type attribute
+
it("url", function(done) {
cssRule.use = [
{
@@ -261,6 +281,28 @@ describe("basic tests", function() {
runCompilerTest(expected, done);
}); // it url with attrs
+ it("url with type attribute", function (done) {
+ cssRule.use = [
+ {
+ loader: "style-loader/url",
+ options: {
+ attrs: {
+ type: 'text/less'
+ }
+ }
+ },
+ "file-loader"
+ ];
+
+ // Run
+ let expected = [
+ existingStyle,
+ ''
+ ].join("\n");
+
+ runCompilerTest(expected, done);
+ }); // it url with type attribute
+
it("useable", function(done) {
cssRule.use = [
{