@@ -14,7 +14,7 @@ import runSequence from 'run-sequence';
14
14
import archiver from 'archiver' ;
15
15
import glob from 'glob' ;
16
16
import del from 'del' ;
17
- import sri from 'node-sri ' ;
17
+ import ssri from 'ssri ' ;
18
18
import modernizr from 'modernizr' ;
19
19
20
20
import pkg from './package.json' ;
@@ -91,20 +91,20 @@ gulp.task('copy:.htaccess', () =>
91
91
. pipe ( gulp . dest ( dirs . dist ) )
92
92
) ;
93
93
94
- gulp . task ( 'copy:index.html' , ( done ) =>
95
- sri . hash ( 'node_modules/jquery/dist/jquery.min.js' , ( err , hash ) => {
96
- if ( err ) throw err ;
97
-
98
- let version = pkg . devDependencies . jquery ;
99
- let modernizrVersion = pkg . devDependencies . modernizr ;
100
- gulp . src ( ` ${ dirs . src } /index.html` )
101
- . pipe ( plugins ( ) . replace ( / { { JQUERY _ V E R S I O N } } / g , version ) )
102
- . pipe ( plugins ( ) . replace ( / { { MODERNIZR _ V E R S I O N } } / g , modernizrVersion ) )
103
- . pipe ( plugins ( ) . replace ( / { { JQUERY _ S R I _ H A S H } } / g, hash ) )
104
- . pipe ( gulp . dest ( dirs . dist ) ) ;
105
- done ( ) ;
106
- } )
107
- ) ;
94
+ gulp . task ( 'copy:index.html' , ( ) => {
95
+ const hash = ssri . fromData (
96
+ fs . readFileSync ( 'node_modules/jquery/dist/jquery.min.js' ) ,
97
+ { algorithms : [ 'sha256' ] }
98
+ ) ;
99
+ let version = pkg . devDependencies . jquery ;
100
+ let modernizrVersion = pkg . devDependencies . modernizr ;
101
+
102
+ gulp . src ( ` ${ dirs . src } /index.html` )
103
+ . pipe ( plugins ( ) . replace ( / { { JQUERY _ V E R S I O N } } / g, version ) )
104
+ . pipe ( plugins ( ) . replace ( / { { MODERNIZR _ V E R S I O N } } / g , modernizrVersion ) )
105
+ . pipe ( plugins ( ) . replace ( / { { JQUERY _ S R I _ H A S H } } / g , hash . toString ( ) ) )
106
+ . pipe ( gulp . dest ( dirs . dist ) ) ;
107
+ } ) ;
108
108
109
109
gulp . task ( 'copy:jquery' , ( ) =>
110
110
gulp . src ( [ 'node_modules/jquery/dist/jquery.min.js' ] )
0 commit comments