Skip to content

a carbon copy of karma-html2js-preprocessor only with a different name and a different global

License

Notifications You must be signed in to change notification settings

kenglxn/karma-json2js-preprocessor

Repository files navigation

karma-json2js-preprocessor

a carbon copy of karma-html2js-preprocessor. Only difference is the name, and the fact that it stores files in window._json_ instead of window._html_

If you need this just use html2js instead:

module.exports = function (config) {
  config.set({
    frameworks: ["jasmine"],
    files: [
        '**/*.js',
        '**/*.html',
        '**/*.json',
        '**/*.spec.js'
    ],
    plugins: [
        'karma-html2js-preprocessor'
    ]
    preprocessors: {
        '**/*.html': ['html2js'],
        '**/*.json': ['html2js']
    }
  });
};

Then do what you need with the json or html:

var exampleJson = __html__['example.json'];
var jsonObj = JSON.parse(exampleJson);
var exampleHtml = __html__['example.html'];
document.body.innerHTML = exampleHtml;

Related:

About

a carbon copy of karma-html2js-preprocessor only with a different name and a different global

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published