Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/frontend-layers/html-test
Node.js library for testing HTML files on the fly and output errors in the console with Gulp.js compatibilities
https://github.com/frontend-layers/html-test
gulp html html-test html-validation html-validations html5 nodejs nodejs-modules test test-automation validate validation w3c w3c-validator
Last synced: 3 days ago
JSON representation
Node.js library for testing HTML files on the fly and output errors in the console with Gulp.js compatibilities
- Host: GitHub
- URL: https://github.com/frontend-layers/html-test
- Owner: Frontend-Layers
- License: mit
- Created: 2022-09-02T16:52:08.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-03T20:55:13.000Z (over 1 year ago)
- Last Synced: 2024-11-19T15:53:50.331Z (2 months ago)
- Topics: gulp, html, html-test, html-validation, html-validations, html5, nodejs, nodejs-modules, test, test-automation, validate, validation, w3c, w3c-validator
- Language: HTML
- Homepage:
- Size: 175 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# HTML Test
_Node.js library for testing HTML files on the fly and output errors in the console with Gulp.js compatibilities_
[![License:MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/andreymatin/html-test/LICENSE)
[![npm](https://img.shields.io/npm/v/html-test.svg)](https://www.npmjs.com/package/html-test)## How to install
### npm
```shell
npm i --save-dev html-test
```### yarn
```shell
yarn add --dev html-test
```## How to use
```javascript
import htmlTest from 'htmlTest';htmlTest('./html/**/*.html');
``````javascript
import htmlTest from 'htmlTest';htmlTest('./html/**/*.html', { ignore: 'html/ignore-me/**' });
```## Gulp.js integration
```javascript
import gulp from 'gulp';
const { parallel, watch } = gulp;import htmlTest from 'htmlTest';
const htmlTestRes = () =>
htmlTest('./html/**/*.html', { ignore: ['html/ignore-me/**', 'node_modules/**'] });const watcher = () => {
watch('./html/*.html', htmlTestRes);
};export default
parallel(
htmlTestRes,
watcher
)
```## Config
- first parameter - source folder
- ignore - ignored folder/s
- hide - hide errors for template expression/s - 'js-literals', 'handlebars' etc.fore exmaple:
```javascript
htmlTest('./html/**/*.html', { ignore: ['html/ignore-me/**'], hide: ['js-literals']});
```## Limitations
API limitation is 5 remote requests by one time.
To extend it need to add iterations timeout.
It means validation will be processed with ignorance
some of the requests to avoid waiting delays or
need to select prioritized html files.## Recommendations
It's created for fast and rought in-development
results without boring test delays and information overflow.
So it shows critical errors only in a minimalistic way to console.For full report with flexible configuration, I recommend:
- automation by gulp.js - https://github.com/center-key/gulp-w3c-html-validator
- https://validator.w3.org/## Reference
- Markup Validator Web Service API (https://validator.w3.org/docs/api.html)
## Related Projects
I created this and some additional services for [html-base](https://www.npmjs.com/package/html-base) to improve quality of frontend output. Here is the list:
- [scss-reset](https://www.npmjs.com/package/scss-reset)
- [scss-mixins-npm](https://www.npmjs.com/package/scss-mixins-npm)
- [mobile-friendly-test-npm](https://www.npmjs.com/package/mobile-friendly-test-npm)
- [html-speed](https://www.npmjs.com/package/html-speed)
- [css-test-npm](https://www.npmjs.com/package/css-test-npm)## Contributing
For issues, bugs or imporvements please open an [issue](https://github.com/andreymatin/html-test/issues/new)
---
[MIT License](LICENSE)