File tree 2 files changed +3
-18
lines changed
2 files changed +3
-18
lines changed Original file line number Diff line number Diff line change 1
1
const path = require ( 'path' )
2
2
3
3
const { getOptions } = require ( './options' )
4
- const { readJSFiles, compileTemplate } = require ( './utils' )
4
+ const { readJSFiles } = require ( './utils' )
5
5
6
6
module . exports = function nuxtWorkbox ( workboxOptions ) {
7
7
this . nuxt . hook ( 'build:before' , async ( ) => {
@@ -27,7 +27,7 @@ module.exports = function nuxtWorkbox (workboxOptions) {
27
27
28
28
// Add sw.js
29
29
if ( options . swTemplate ) {
30
- await compileTemplate . call ( this , {
30
+ await this . addTemplate ( {
31
31
src : options . swTemplate ,
32
32
fileName : options . swDest ,
33
33
options : {
Original file line number Diff line number Diff line change @@ -16,21 +16,6 @@ async function readJSFiles (files) {
16
16
return contents . join ( '\n\n' )
17
17
}
18
18
19
- async function compileTemplate ( { src, fileName, options } ) {
20
- const fileContent = await readFile ( src , 'utf8' )
21
- try {
22
- const templateFunction = template ( fileContent )
23
- const contents = templateFunction ( {
24
- dev : this . options . dev ,
25
- options
26
- } )
27
- await outputFile ( fileName , contents , 'utf8' )
28
- } catch ( err ) {
29
- throw new Error ( `Could not compile template ${ src } : ${ err . message } ` )
30
- }
31
- }
32
-
33
19
module . exports = {
34
- readJSFiles,
35
- compileTemplate
20
+ readJSFiles
36
21
}
You can’t perform that action at this time.
0 commit comments