-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
1 parent
50c3d6d
commit 828cfcb
Showing
29 changed files
with
1,006 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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,6 @@ | ||
node_modules | ||
package-lock.json | ||
yarn.lock | ||
*.result.css | ||
*.result.css.map | ||
*.result.html |
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 @@ | ||
v20.2.0 |
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,5 @@ | ||
# Changes to PostCSS Content Alt Text | ||
|
||
### Unreleased (major) | ||
|
||
- Initial version |
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,235 @@ | ||
# Installing PostCSS Content Alt Text | ||
|
||
[PostCSS Content Alt Text] runs in all Node environments, with special instructions for: | ||
|
||
- [Node](#node) | ||
- [PostCSS CLI](#postcss-cli) | ||
- [PostCSS Load Config](#postcss-load-config) | ||
- [Webpack](#webpack) | ||
- [Next.js](#nextjs) | ||
- [Gulp](#gulp) | ||
- [Grunt](#grunt) | ||
|
||
|
||
|
||
## Node | ||
|
||
Add [PostCSS Content Alt Text] to your project: | ||
|
||
```bash | ||
npm install postcss @csstools/postcss-content-alt-text --save-dev | ||
``` | ||
|
||
Use it as a [PostCSS] plugin: | ||
|
||
```js | ||
// commonjs | ||
const postcss = require('postcss'); | ||
const postcssContentAltText = require('@csstools/postcss-content-alt-text'); | ||
|
||
postcss([ | ||
postcssContentAltText(/* pluginOptions */) | ||
]).process(YOUR_CSS /*, processOptions */); | ||
``` | ||
|
||
```js | ||
// esm | ||
import postcss from 'postcss'; | ||
import postcssContentAltText from '@csstools/postcss-content-alt-text'; | ||
|
||
postcss([ | ||
postcssContentAltText(/* pluginOptions */) | ||
]).process(YOUR_CSS /*, processOptions */); | ||
``` | ||
|
||
## PostCSS CLI | ||
|
||
Add [PostCSS CLI] to your project: | ||
|
||
```bash | ||
npm install postcss-cli @csstools/postcss-content-alt-text --save-dev | ||
``` | ||
|
||
Use [PostCSS Content Alt Text] in your `postcss.config.js` configuration file: | ||
|
||
```js | ||
const postcssContentAltText = require('@csstools/postcss-content-alt-text'); | ||
|
||
module.exports = { | ||
plugins: [ | ||
postcssContentAltText(/* pluginOptions */) | ||
] | ||
} | ||
``` | ||
|
||
## PostCSS Load Config | ||
|
||
If your framework/CLI supports [`postcss-load-config`](https://github.com/postcss/postcss-load-config). | ||
|
||
```bash | ||
npm install @csstools/postcss-content-alt-text --save-dev | ||
``` | ||
|
||
`package.json`: | ||
|
||
```json | ||
{ | ||
"postcss": { | ||
"plugins": { | ||
"@csstools/postcss-content-alt-text": {} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
`.postcssrc.json`: | ||
|
||
```json | ||
{ | ||
"plugins": { | ||
"@csstools/postcss-content-alt-text": {} | ||
} | ||
} | ||
``` | ||
|
||
_See the [README of `postcss-load-config`](https://github.com/postcss/postcss-load-config#usage) for more usage options._ | ||
|
||
## Webpack | ||
|
||
_Webpack version 5_ | ||
|
||
Add [PostCSS Loader] to your project: | ||
|
||
```bash | ||
npm install postcss-loader @csstools/postcss-content-alt-text --save-dev | ||
``` | ||
|
||
Use [PostCSS Content Alt Text] in your Webpack configuration: | ||
|
||
```js | ||
module.exports = { | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/i, | ||
use: [ | ||
"style-loader", | ||
{ | ||
loader: "css-loader", | ||
options: { importLoaders: 1 }, | ||
}, | ||
{ | ||
loader: "postcss-loader", | ||
options: { | ||
postcssOptions: { | ||
plugins: [ | ||
// Other plugins, | ||
[ | ||
"@csstools/postcss-content-alt-text", | ||
{ | ||
// Options | ||
}, | ||
], | ||
], | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}; | ||
``` | ||
|
||
## Next.js | ||
|
||
Read the instructions on how to [customize the PostCSS configuration in Next.js](https://nextjs.org/docs/advanced-features/customizing-postcss-config) | ||
|
||
```bash | ||
npm install @csstools/postcss-content-alt-text --save-dev | ||
``` | ||
|
||
Use [PostCSS Content Alt Text] in your `postcss.config.json` file: | ||
|
||
```json | ||
{ | ||
"plugins": [ | ||
"@csstools/postcss-content-alt-text" | ||
] | ||
} | ||
``` | ||
|
||
```json5 | ||
{ | ||
"plugins": [ | ||
[ | ||
"@csstools/postcss-content-alt-text", | ||
{ | ||
// Optionally add plugin options | ||
} | ||
] | ||
] | ||
} | ||
``` | ||
|
||
## Gulp | ||
|
||
Add [Gulp PostCSS] to your project: | ||
|
||
```bash | ||
npm install gulp-postcss @csstools/postcss-content-alt-text --save-dev | ||
``` | ||
|
||
Use [PostCSS Content Alt Text] in your Gulpfile: | ||
|
||
```js | ||
const postcss = require('gulp-postcss'); | ||
const postcssContentAltText = require('@csstools/postcss-content-alt-text'); | ||
|
||
gulp.task('css', function () { | ||
var plugins = [ | ||
postcssContentAltText(/* pluginOptions */) | ||
]; | ||
|
||
return gulp.src('./src/*.css') | ||
.pipe(postcss(plugins)) | ||
.pipe(gulp.dest('.')); | ||
}); | ||
``` | ||
|
||
## Grunt | ||
|
||
Add [Grunt PostCSS] to your project: | ||
|
||
```bash | ||
npm install grunt-postcss @csstools/postcss-content-alt-text --save-dev | ||
``` | ||
|
||
Use [PostCSS Content Alt Text] in your Gruntfile: | ||
|
||
```js | ||
const postcssContentAltText = require('@csstools/postcss-content-alt-text'); | ||
|
||
grunt.loadNpmTasks('grunt-postcss'); | ||
|
||
grunt.initConfig({ | ||
postcss: { | ||
options: { | ||
processors: [ | ||
postcssContentAltText(/* pluginOptions */) | ||
] | ||
}, | ||
dist: { | ||
src: '*.css' | ||
} | ||
} | ||
}); | ||
``` | ||
|
||
[Gulp PostCSS]: https://github.com/postcss/gulp-postcss | ||
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss | ||
[PostCSS]: https://github.com/postcss/postcss | ||
[PostCSS CLI]: https://github.com/postcss/postcss-cli | ||
[PostCSS Loader]: https://github.com/postcss/postcss-loader | ||
[PostCSS Content Alt Text]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-content-alt-text | ||
[Next.js]: https://nextjs.org |
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,18 @@ | ||
MIT No Attribution (MIT-0) | ||
|
||
Copyright © CSSTools Contributors | ||
|
||
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. | ||
|
||
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. |
Oops, something went wrong.