-
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.
- Loading branch information
Showing
5 changed files
with
8,362 additions
and
0 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,13 @@ | ||
language: node_js | ||
cache: | ||
directories: | ||
- ~/.npm | ||
notifications: | ||
email: false | ||
node_js: | ||
- '10' | ||
after_success: | ||
- npm run travis-deploy-once "npm run semantic-release" | ||
branches: | ||
except: | ||
- /^v\d+\.\d+\.\d+$/ |
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,2 +1,51 @@ | ||
# sass-scope-loader | ||
|
||
[![Build Status](https://travis-ci.org/ElderAS/sass-scope-loader.svg?branch=master&style=flat-square)](https://travis-ci.org/ElderAS/sass-scope-loader) | ||
[![npm](https://img.shields.io/npm/dt/sass-scope-loader.svg?style=flat-square)](https://www.npmjs.com/package/sass-scope-loader) | ||
[![npm](https://img.shields.io/npm/v/sass-scope-loader.svg?style=flat-square)](https://www.npmjs.com/package/sass-scope-loader) | ||
|
||
Sass loader to scope styles inside selector | ||
|
||
This plugin scopes all your styles inside a configurable selector: | ||
|
||
```scss | ||
//Before sass-scope-loader | ||
.input { | ||
//... | ||
} | ||
|
||
//After sass-scope-loader width options.selector ".my-plugin" | ||
.my-plugin .input { | ||
//... | ||
} | ||
``` | ||
|
||
### Installation | ||
|
||
`npm install --save sass-scope-loader` | ||
|
||
### Usage | ||
|
||
```js | ||
/* webpack.config.js */ | ||
module.exports = { | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.scss$/, | ||
use: { | ||
loader: 'sass-scope-loader', | ||
options: { | ||
selector: '.SCOPESELECTOR', | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
} | ||
``` | ||
|
||
## License | ||
|
||
[The MIT License](http://opensource.org/licenses/MIT) | ||
Copyright (c) Carsten Jacobsen |
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,24 @@ | ||
const { getOptions } = require('loader-utils') | ||
const validateOptions = require('schema-utils') | ||
|
||
const schema = { | ||
type: 'object', | ||
properties: { | ||
selector: { | ||
type: 'string', | ||
}, | ||
}, | ||
} | ||
|
||
module.exports = function(source) { | ||
const options = getOptions(this) || {} | ||
|
||
if (!options.selector) { | ||
console.error('SassScopeLoader: options.selector is required') | ||
return source | ||
} | ||
|
||
validateOptions(schema, options, 'SassScopeLoader') | ||
|
||
return `${options.selector} { ${source} }` | ||
} |
Oops, something went wrong.