diff --git a/gulpfile.js b/gulpfile.js index 6409b2f..a6b6952 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -31,7 +31,16 @@ gulp.task('inlineHtml', ['clean', 'browserify'], function() { jsSelector: 'script[uglify]' })) .pipe(minifyHTML()) - .pipe(gulp.dest('dist/')); + .pipe(gulp.dest('tmp/')); }); -gulp.task('default', ['inlineHtml']); +gulp.task('clay', ['inlineHtml'], function() { + return browserify('index.js', { debug: false }) + .transform(stringify(['.html', '.mustache'])) + .require(require.resolve('./index'), {expose: 'pebble-clay'}) + .bundle() + .pipe(source('clay.js')) + .pipe(gulp.dest('./dist/')); +}); + +gulp.task('default', ['clay']); diff --git a/index.js b/index.js index 885f275..f9bda32 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ 'use strict'; -var configPageHtml = require('./dist/config-page.html'); +var configPageHtml = require('./tmp/config-page.html'); function encodeDataUri(input) { if (window.btoa) { diff --git a/mold.js b/mold.js index c5ae6ed..b1f5bf1 100644 --- a/mold.js +++ b/mold.js @@ -4,8 +4,6 @@ var browserify = require('browserify'); var source = require('vinyl-source-stream'); var gulp = require('gulp'); var path = require('path'); -var template = require('gulp-template'); -var stringify = require('stringify'); var del = require('del'); var projectPath = process.argv[2] || process.cwd(); @@ -19,16 +17,11 @@ gulp.task('clean', function() { return del([pebbleJsPath]); }); -gulp.task('build', ['clean', 'pebble-js-app'], function() { - -}); - -gulp.task('pebble-js-app', function() { +gulp.task('pebble-js-app', ['clean'], function() { browserify(clayJsPath, { debug: false }) - .transform(stringify(['.html', '.mustache'])) .bundle() .pipe(source('pebble-js-app.js')) .pipe(gulp.dest('./src/js/')); }); -gulp.start('build'); +gulp.start('pebble-js-app'); diff --git a/package.json b/package.json index 194fd78..6dbb3f8 100644 --- a/package.json +++ b/package.json @@ -2,12 +2,13 @@ "name": "pebble-clay", "version": "1.0.0", "description": "Pebble Config Framework", - "main": "index.js", + "main": "dist/clay.js", "directories": { "example": "example" }, "scripts": { - "test": "mocha" + "test": "mocha", + "build": "gulp" }, "repository": { "type": "git", @@ -33,6 +34,7 @@ "browserify-mustache": "0.0.4", "del": "^2.0.2", "gulp": "^3.9.0", + "gulp-html-to-js": "0.0.1", "gulp-inline": "0.0.15", "gulp-minify-html": "^1.0.4", "gulp-minify-inline": "^0.1.1", diff --git a/src/config-page.html b/src/config-page.html index 2419edd..917ad92 100644 --- a/src/config-page.html +++ b/src/config-page.html @@ -15,6 +15,6 @@
- +