1.0.0 • Published 5 years ago

gulp-service-worker-app-cache-builder v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

gulp-service-worker-app-cache-builder

Inspects a C# project file and generates an service worker based application cache for included items. It allows the use of an ExcludeString to filter included items that are not needed in the manifest.

Installation

Install package with NPM and add it to your development dependencies:

npm install --save-dev gulp-service-worker-app-cache-builder

Usage

const gulp = require('gulp');
const rename = require('gulp-rename');
const gulpAppCacheBuilder = require('gulp-service-worker-app-cache-builder');

gulp.task('default', function () {
    var projectFile = "C:/Development/BaBackOffice/BaBackOffice.Web/BaBackOffice.Web.csproj";
    var serviceWorkerFile = "C:/Development/BaBackOffice/BaBackOffice.Web/ts_AppCache/appCacheServiceWorker.ts";
    var excludeString = ".master,.config,.rpt,.svc,/aspnet_client/,/controls/,/email/,ForgotPassword.aspx,ReportViewer.aspx,.txt,appCacheSurrogate.html,offline.appcache,siteversion.config.xml,.map,/less/,/ts/,compilerconfig.json,packages.config,/@(TypeScriptCompile),/Properties";
    

    return appCacheBuilder({
        ProjectFile: projectFile,
        ExcludeString: excludeString,
        ServiceWorkerFile: serviceWorkerFile
    })
        .pipe(rename("output.txt"))
        .pipe(gulp.dest("."));

});

Options

ProjectFile is the path to the C# csproj that will be used for input.

ExcludeString is a comma delimited string that contains regex matchs for paths. You can exclude files by extension(.config) or folders(/ts/).