Skip to content

Commit

Permalink
Merge pull request #133 from posthtml/feat/esm
Browse files Browse the repository at this point in the history
  • Loading branch information
cossssmin authored Feb 26, 2024
2 parents 249a46a + 3d9b088 commit d9b054e
Show file tree
Hide file tree
Showing 10 changed files with 7,696 additions and 14,207 deletions.
18 changes: 18 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"parserOptions": {
"sourceType": "module"
},
"rules": {
"indent": [2, 2, {"SwitchCase": 1}],
"quotes": [2, "single"],
"linebreak-style": [2, "unix"],
"camelcase": [2, {"properties": "always"}],
"brace-style": [2, "1tbs", {"allowSingleLine": true}]
},
"env": {
"es6": true,
"node": true,
"browser": false
},
"extends": "eslint:recommended"
}
4 changes: 1 addition & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: monthly
time: "22:00"
open-pull-requests-limit: 10
interval: weekly
9 changes: 4 additions & 5 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,22 @@ on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14, 16, 18]
node-version: [18, 20]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm ci
- run: npm test
env:
CI: true
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ $ npm i posthtml posthtml-postcss-merge-longhand
## Usage

```js
const posthtml = require('posthtml')
const mergeInlineLonghand = require('posthtml-postcss-merge-longhand')
import posthtml from 'posthtml'
import mergeInlineLonghand from 'posthtml-postcss-merge-longhand'

const html = '<div style="margin-top: 1px; margin-right: 2px; margin-bottom: 3px; margin-left: 4px;">Test</div>'

Expand All @@ -60,8 +60,8 @@ Array of tag names to process. All other tags will be skipped.
Example:

```js
const posthtml = require('posthtml')
const mergeInlineLonghand = require('posthtml-postcss-merge-longhand')
import posthtml from 'posthtml'
import mergeInlineLonghand from 'posthtml-postcss-merge-longhand'

const html = `
<div style="margin-top: 1px; margin-right: 2px; margin-bottom: 3px; margin-left: 4px;">Test</div>
Expand All @@ -84,5 +84,5 @@ posthtml([
[npm-stats-shield]: https://img.shields.io/npm/dt/posthtml-postcss-merge-longhand.svg
[github-ci]: https://github.com/posthtml/posthtml-postcss-merge-longhand/actions
[github-ci-shield]: https://github.com/posthtml/posthtml-postcss-merge-longhand/actions/workflows/nodejs.yml/badge.svg
[license]: ./license
[license]: ./LICENSE
[license-shield]: https://img.shields.io/npm/l/posthtml-postcss-merge-longhand.svg
12 changes: 6 additions & 6 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
'use strict'
import postcss from 'postcss'
import safe from 'postcss-safe-parser'
import mergeLonghand from 'postcss-merge-longhand'

const postcss = require('postcss')
const safe = require('postcss-safe-parser')
const mergeLonghand = require('postcss-merge-longhand')

module.exports = (options = {}) => tree => {
const plugin = (options = {}) => tree => {
options.tags = options.tags || []

const process = node => {
Expand All @@ -24,3 +22,5 @@ module.exports = (options = {}) => tree => {

return tree.walk(process)
}

export default plugin
Loading

0 comments on commit d9b054e

Please sign in to comment.