Skip to content

Commit a1e87dd

Browse files
author
vvo
committed
feat(slider): allow overriding css classes from a user stylesheet
We now use our style-loader fork to be able to `prepend` a component `<style>` instead of appending it to the `<head>`. So that we can now override component style from a stylesheet in the html page.
1 parent 6c346c4 commit a1e87dd

File tree

6 files changed

+4
-10
lines changed

6 files changed

+4
-10
lines changed

components/Slider/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var React = require('react');
22

33
var Nouislider = require('react-nouislider');
44

5-
require('./index.css');
5+
require('style?prepend!raw!./index.css');
66

77
var cssPrefix = 'as-range-slider--';
88

example/app.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
require('./style.css');
2-
31
var instantsearch = require('../');
42

53
var search = instantsearch({

example/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<title>Instant search demo built with instantsearch.js</title>
66
<link rel="stylesheet" href="//cdn.jsdelivr.net/bootstrap/3.3.5/css/bootstrap.min.css">
77
<link rel="stylesheet" href="//cdn.jsdelivr.net/bootstrap/3.3.5/css/bootstrap-theme.min.css">
8+
<link rel="stylesheet" href="./style.css">
89
</head>
910
<body>
1011
<div class="container">

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
"babel-eslint": "4.1.1",
2828
"babel-loader": "5.3.2",
2929
"babel-tape-runner": "1.2.0",
30-
"css-loader": "0.16.0",
31-
"raw-loader": "0.5.1",
3230
"doctoc": "0.15.0",
3331
"eslint": "1.4.1",
3432
"eslint-config-airbnb": "0.0.8",
@@ -39,8 +37,9 @@
3937
"onchange": "2.0.0",
4038
"pretty-bytes": "2.0.1",
4139
"proxyquire": "1.7.1",
40+
"raw-loader": "0.5.1",
4241
"sinon": "1.16.1",
43-
"style-loader": "0.12.3",
42+
"style-loader": "algolia/style-loader#3ec5a83b23607339e25fe65d51ae823ba9a8e7df",
4443
"tap-spec": "4.1.0",
4544
"tape": "4.2.0",
4645
"uglifyjs": "2.4.10",

webpack.config.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ module.exports = {
1111
test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'
1212
}, {
1313
test: /\.html$/, exclude: /node_modules/, loader: 'raw'
14-
}, {
15-
test: /\.css$/, loader: 'style-loader!css-loader'
1614
}]
1715
}
1816
};

webpack.example.config.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ module.exports = {
1010
test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'
1111
}, {
1212
test: /\.html$/, exclude: /node_modules/, loader: 'raw'
13-
}, {
14-
test: /\.css$/, loader: 'style-loader!css-loader'
1513
}]
1614
},
1715
devServer: {

0 commit comments

Comments
 (0)