From a544f278cdfa2b5d6cefe67792a89478ea2fe7be Mon Sep 17 00:00:00 2001 From: yutent Date: Thu, 25 Jul 2024 16:42:09 +0800 Subject: [PATCH] init --- .gitignore | 15 +++++++++++++++ .prettierrc.yaml | 10 ++++++++++ LICENSE | 21 +++++++++++++++++++++ Readme.md | 19 +++++++++++++++++++ index.js | 19 +++++++++++++++++++ package.json | 13 +++++++++++++ 6 files changed, 97 insertions(+) create mode 100644 .gitignore create mode 100644 .prettierrc.yaml create mode 100644 LICENSE create mode 100644 Readme.md create mode 100644 index.js create mode 100644 package.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..372c52e --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +.vscode +node_modules/ +dist + +*.sublime-project +*.sublime-workspace +package-lock.json + +._* + +.Spotlight-V100 +.Trashes +.DS_Store +.AppleDouble +.LSOverride \ No newline at end of file diff --git a/.prettierrc.yaml b/.prettierrc.yaml new file mode 100644 index 0000000..b007fb1 --- /dev/null +++ b/.prettierrc.yaml @@ -0,0 +1,10 @@ +jsxBracketSameLine: true +jsxSingleQuote: true +semi: false +singleQuote: true +printWidth: 80 +useTabs: false +tabWidth: 2 +trailingComma: none +bracketSpacing: true +arrowParens: avoid \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ab60297 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..315bcff --- /dev/null +++ b/Readme.md @@ -0,0 +1,19 @@ +## fite-plugin-autoprefixer + + +```js + +import autoprefixer from 'fite-plugin-autoprefixer' + + + +// fite.config.js + +export default { + ..., + plugin: [ autoprefixer('chrome 89') ], + ... +} + + +``` \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..a731901 --- /dev/null +++ b/index.js @@ -0,0 +1,19 @@ +/** + * {} + * @author yutent + * @date 2024/07/25 16:39:23 + */ + +import autoprefixer from 'autoprefixer' +import postcss from 'postcss' + +export default function (browers = 'chrome 89, safari 13.1') { + return function (ext, data) { + if (ext === 'css') { + return postcss([autoprefixer(browers)]) + .process(data, { from: '' }) + .then(r => r.css) + } + return data + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..88a6488 --- /dev/null +++ b/package.json @@ -0,0 +1,13 @@ +{ + "name": "fite-plugin-autoprefixer", + "type": "module", + "version": "1.0.0", + "main": "index.js", + "dependencies": { + "autoprefixer": "^10.4.19" + }, + "engines": { + "node": ">=16.6.0" + }, + "license": "MIT" +}