Skip to content

Commit

Permalink
Fix csscritic.js loader not loading external dependencies with npm >=…
Browse files Browse the repository at this point in the history
… 3 flat dependencies. Closes #77
  • Loading branch information
cburgmer committed Jan 15, 2016
1 parent 9b1da8f commit 77411c0
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions csscritic.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
'src/browser/niceReporter.css'
],
jsDependencies = [
'node_modules/rasterizehtml/dist/rasterizeHTML.allinone.js',
'node_modules/imagediff/imagediff.js',
'node_modules/ayepromise/ayepromise.js',
'src/boot/scope.js',
'src/browser/pageNavigationHandlingFallback.js',
'src/browser/niceReporter.js',
Expand All @@ -30,6 +27,11 @@
'src/main.js',
'packageVersion.js',
'src/boot/browser.js'
],
externalJsDependencies = [
'rasterizehtml/dist/rasterizeHTML.allinone.js',
'imagediff/imagediff.js',
'ayepromise/ayepromise.js'
];

var getCurrentScript = function () {
Expand All @@ -54,12 +56,22 @@
document.write('<script src="' + path + '"></script>');
};

var loadExternalJsDependency = function (basePath, path) {
loadJsDependency(basePath + '../../node_modules/' + path);
// Fallback to npm <3
loadJsDependency(basePath + 'node_modules/' + path);
};

var basePath = getBasePath();

cssDependencies.forEach(function (path) {
loadCssDependency(basePath + path);
});

externalJsDependencies.forEach(function (path) {
loadExternalJsDependency(basePath, path);
});

jsDependencies.forEach(function (path) {
loadJsDependency(basePath + path);
});
Expand Down

0 comments on commit 77411c0

Please sign in to comment.