You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

karma-html2js-preprocessor

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

karma-html2js-preprocessor - npm Package Compare versions

Comparing version

to
1.1.0

14

lib/html2js.js

@@ -12,4 +12,12 @@ var util = require('util');

var createHtml2JsPreprocessor = function(logger, basePath) {
var createHtml2JsPreprocessor = function(logger, basePath, config) {
config = typeof config === 'object' ? config : {};
var log = logger.create('preprocessor.html2js');
var stripPrefix = config.stripPrefix ? new RegExp('^' + config.stripPrefix) : null;
var prependPrefix = config.prependPrefix ? config.prependPrefix : '';
var processPath = config.processPath || function(htmlPath) {
htmlPath = prependPrefix + htmlPath.replace(stripPrefix, '');
return htmlPath;
};

@@ -19,3 +27,3 @@ return function(content, file, done) {

var htmlPath = file.originalPath.replace(basePath + '/', '');
var htmlPath = processPath(file.originalPath.replace(basePath + '/', ''));

@@ -27,4 +35,4 @@ file.path = file.path + '.js';

createHtml2JsPreprocessor.$inject = ['logger', 'config.basePath'];
createHtml2JsPreprocessor.$inject = ['logger', 'config.basePath', 'config.html2JsPreprocessor'];
module.exports = createHtml2JsPreprocessor;
{
"name": "karma-html2js-preprocessor",
"version": "1.0.0",
"version": "1.1.0",
"description": "A Karma plugin. Convert HTML files into JS strings to serve them in a script tag.",

@@ -22,10 +22,10 @@ "main": "lib/index.js",

"devDependencies": {
"grunt": "~0.4.1",
"grunt": "~1.0.1",
"grunt-simple-mocha": "~0.4",
"grunt-contrib-jshint": "~0.6",
"chai": "~1.4",
"mocha": "~1.8",
"grunt-contrib-jshint": "~1.0",
"chai": "~3.5",
"mocha": "~3.0",
"grunt-npm": "~0.0.2",
"grunt-bump": "~0.0.7",
"grunt-auto-release": "~0.0.2"
"grunt-bump": "~0.8.0",
"grunt-auto-release": "~0.0.6"
},

@@ -38,3 +38,5 @@ "peerDependencies": {

"Friedel Ziegelmayer <dignifiedquire@gmail.com>",
"Mark Ethan Trostler <mark@zzo.com>",
"Andres Rios <rianby64@gmail.com>",
"Larry Davis <lazdnet@gmail.com>",
"Jochen Ulrich <jochenulrich@t-online.de>",

@@ -41,0 +43,0 @@ "Richard McIntyre <richard.mackstar@gmail.com>"

@@ -25,3 +25,3 @@ # karma-html2js-preprocessor [![Build Status](https://travis-ci.org/karma-runner/karma-html2js-preprocessor.png?branch=master)](https://travis-ci.org/karma-runner/karma-html2js-preprocessor)

## Configuration
Following code shows the default configuration...
```js

@@ -38,3 +38,17 @@ // karma.conf.js

'*.html'
]
],
html2JsPreprocessor: {
// strip this from the file path
stripPrefix: 'public/',
// prepend this to the file path
prependPrefix: 'served/',
// or define a custom transform function
processPath: function(filePath) {
// Drop the file extension
return filePath.replace(/\.html$/, '');
}
}
});

@@ -41,0 +55,0 @@ };