File tree 4 files changed +1626
-0
lines changed
4 files changed +1626
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Файлы и папки операционной системы
2
+ .DS_Store
3
+ Thumbs.db
4
+
5
+ # Файлы редактора
6
+ .idea
7
+ * .sublime *
8
+ .vscode
9
+
10
+ # Вспомогательные файлы
11
+ * .log *
12
+ node_modules /
13
+ bower_components /
14
+
15
+ # Папка с собранными файлами проекта
16
+ build /
17
+ src /* .html
18
+ src /images /sprite
19
+ src /images /sprite-svg
20
+ src /images /symbols-svg
21
+ src /js /script.js
22
+ src /css /
Original file line number Diff line number Diff line change
1
+ import through from 'through2' ;
2
+ import { HtmlValidate } from 'html-validate' ;
3
+ import { text as textFormat } from 'html-validate/build/formatters/text' ;
4
+ import c from "ansi-colors" ;
5
+ import log from "fancy-log" ;
6
+ import PluginError from "plugin-error" ;
7
+
8
+ const PLUGIN_NAME = 'gulp-html-validate' ;
9
+
10
+ function validate ( file , encoding , callback ) {
11
+ try {
12
+ const htmlvalidate = new HtmlValidate ( ) ;
13
+ const report = htmlvalidate . validateFile ( file . path ) ;
14
+
15
+ if ( ! report . valid ) {
16
+ log ( c . red ( `File is not valid => ${ report . results [ 0 ] . filePath } ` ) ) ;
17
+ log ( c . green ( `File - ${ textFormat ( report . results ) } ` ) ) ;
18
+ }
19
+ callback ( null , file ) ;
20
+ } catch ( error ) {
21
+ const err = new PluginError ( {
22
+ plugin : PLUGIN_NAME ,
23
+ message : error
24
+ } ) ;
25
+
26
+ log . error ( err ) ;
27
+ }
28
+ }
29
+
30
+ module . exports = ( ) => through . obj ( validate ) ;
You can’t perform that action at this time.
0 commit comments