Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
sudo: false
language: node_js
node_js:
- "5.1.0"
- "4.2.2"
- "6"
- "5"
- "4"

after_script:
- './node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls'
27 changes: 22 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "postcss-attribute-selector-prefix",
"version": "0.0.3",
"version": "0.0.4",
"description": "A attribute selector prefixer for postcss",
"main": "./lib/index.js",
"scripts": {
"test": "xo ./src/*.js ./test/*.js && nyc ava",
"test": "eslint --format=node_modules/eslint-formatter-pretty ./src/*.js ./test/*.js && nyc ava",
"clean": "rm -rf lib && mkdir lib",
"build": "npm run clean && babel src/index.js --out-file lib/index.js && npm t",
"prepublish": "npm run build",
Expand Down Expand Up @@ -39,18 +39,35 @@
"babel-register"
]
},
"eslintConfig": {
"plugins": [
"ava",
"xo",
"babel"
],
"extends": [
"xo",
"plugin:xo/recommended",
"plugin:ava/recommended"
]
},
"dependencies": {
"postcss": "^5.0.19"
},
"devDependencies": {
"ava": "^0.14.0",
"babel-cli": "^6.7.7",
"babel-plugin-add-module-exports": "^0.1.2",
"babel-plugin-add-module-exports": "^0.1.4",
"babel-preset-node5": "^11.0.2",
"babel-register": "^6.7.2",
"coveralls": "^2.11.9",
"eslint": "^2.8.0",
"eslint-config-xo": "^0.13.0",
"eslint-formatter-pretty": "^0.2.1",
"eslint-plugin-ava": "^2.2.1",
"eslint-plugin-babel": "^3.2.0",
"eslint-plugin-xo": "^0.3.1",
"nyc": "^6.4.0",
"updtr": "^0.1.10",
"xo": "^0.13.0"
"updtr": "^0.1.10"
}
}
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const filter = (filter, attributeSelector) => new RegExp(filter.map(attribut =>
export default postcss.plugin('postcss-attribute-selector-prefix', options => {
return nodes => {
return nodes.walkRules(rule => {
rule.selector = rule.selector.replace(/\[.*?\]/g, (match) => {
rule.selector = rule.selector.replace(/\[.*?\]/g, match => {
if (options.prefix === undefined) {
return match;
}
Expand Down
2 changes: 1 addition & 1 deletion test/test-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ test('processing options prefix, filter and attribute selector', t => {
t.is(processing(fixtures, {prefix: 'test-', filter: ['class']}), expected);
});

test('processing options prefix, filter and attribute selector', t => {
test('processing options prefix, filter and attribute selector witch indentical class filter', t => {
const expected = '.class, [type="text"], [alt*="class"] { color:red; }';
const fixtures = '.class, [type="text"], [alt*="class"] { color:red; }';
t.is(processing(fixtures, {prefix: 'test-', filter: ['class']}), expected);
Expand Down