Include paper-core.js in load.js mechanism, and improve root folder guessing again.

This commit is contained in:
Jürg Lehni 2016-01-26 20:26:32 +01:00
parent 6a099003b2
commit 77be5616b6
3 changed files with 8 additions and 13381 deletions

13375
dist/paper-core.js vendored

File diff suppressed because it is too large Load diff

1
dist/paper-core.js vendored Symbolic link
View file

@ -0,0 +1 @@
../src/load.js

View file

@ -16,9 +16,10 @@ var gulp = require('gulp'),
gulp.task('load', ['clean:load'], function() {
return gulp.src('src/load.js')
.pipe(symlink('dist/paper-full.js'));
.pipe(symlink('dist/paper-full.js'))
.pipe(symlink('dist/paper-core.js'));
});
gulp.task('clean:load', function() {
return del([ 'dist/paper-full.js', 'dist/node/**' ]);
return del([ 'dist/paper-full.js', 'dist/paper-core.js', 'dist/node/**' ]);
});

View file

@ -14,7 +14,7 @@
// the browser, avoiding the step of having to manually preprocess it after each
// change. This is very useful during development of the library itself.
if (typeof window === 'object') {
// Browser based loading through Prepro.js:
// Browser based loading through Prepro.js:
/* jshint -W082 */
function load(src) {
@ -28,9 +28,9 @@ if (typeof window === 'object') {
src = scripts[scripts.length - 1].getAttribute('src');
// Assume that we're loading from a non-root folder, either through
// ../../dist/paper-full.js, or directly through ../../src/load.js,
// and match root as all the parts of the path that lead to that folder.
// So we basically just want all the leading '.' and '/' characters:
var root = src.match(/^([.\/]*)/)[1];
// and match root as all the parts of the path that lead to that folder,
// exclude the last bit (dist|src), since that's the sub-folder of paper
var root = src.match(/^(.*\/)\w*\//)[1];
// First load the prepro's browser.js file, which provides the include()
// function for the browser.
load(root + 'node_modules/prepro/lib/browser.js');