Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ismamz/posthtml-alt-always
Always add alt attibute for images that don't have it (accessibility reasons)
https://github.com/ismamz/posthtml-alt-always
Last synced: 15 days ago
JSON representation
Always add alt attibute for images that don't have it (accessibility reasons)
- Host: GitHub
- URL: https://github.com/ismamz/posthtml-alt-always
- Owner: ismamz
- License: other
- Created: 2015-12-17T01:34:40.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-06T12:45:01.000Z (over 7 years ago)
- Last Synced: 2024-10-12T00:47:36.392Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Alt Always
[![NPM Version][npm-img]][npm] [![Build Status][ci-img]][ci]
[Alt Always](http://github.com/ismamz/posthtml-alt-always) is a [PostHTML] plugin that always add alt attribute for images that don't have it (accessibility reasons).
> **Every image must have an `alt` attribute.** This is a requirement of HTML standard (with perhaps a few exceptions in HTML5). Images without an alt attribute are likely inaccessible. In some cases, images may be given an empty or null `alt` attribute (e.g., `alt=""`).
Read more about [Alternative Text](http://webaim.org/techniques/alttext/).
```html
```## Usage
Add **Alt Always** to your build tool:
```bash
npm install posthtml-alt-always --save-dev
```#### Node
```js
require('posthtml-alt-always').process(YOUR_HTML, { /* options */ });
```#### PostHTML
Add [PostHTML] to your build tool:
```bash
npm install posthtml --save-dev
```Load Alt Always as a PostHTML plugin:
```js
posthtml([
require('posthtml-alt-always')({ /* options */ })
]).process(YOUR_HTML, /* options */);
```#### Gulp
Add [Gulp PostHTML] to your build tool:
```bash
npm install gulp-posthtml --save-dev
```Enable Alt Always within your Gulpfile:
```js
var posthtml = require('gulp-posthtml');gulp.task('html', function () {
return gulp.src('./src/*.html').pipe(
posthtml([
require('posthtml-alt-always')({ /* options */ })
])
).pipe(
gulp.dest('.')
);
});
```#### Grunt
Add [Grunt PostHTML] to your build tool:
```bash
npm install grunt-posthtml --save-dev
```Enable [alt-always] within your Gruntfile:
```js
grunt.loadNpmTasks('grunt-posthtml');grunt.initConfig({
posthtml: {
options: {
use: [
require('posthtml-alt-always')({ /* options */ })
]
},
dist: {
src: '*.html'
}
}
});
```[ci]: https://travis-ci.org/ismamz/posthtml-alt-always
[ci-img]: https://img.shields.io/travis/ismamz/posthtml-alt-always.svg
[npm]: https://www.npmjs.com/package/posthtml-alt-always
[npm-img]: https://img.shields.io/npm/v/posthtml-alt-always.svg[Gulp PostHTML]: https://github.com/posthtml/gulp-posthtml
[Grunt PostHTML]: https://github.com/TCotton/grunt-posthtml
[PostHTML]: https://github.com/posthtml/posthtml[alt-always]: https://github.com/ismamz/posthtml-alt-always