browserify things

This commit is contained in:
Keegan
2015-10-12 11:57:01 -07:00
parent 53e49339b5
commit 1d0d179429
5 changed files with 19 additions and 15 deletions
+11 -2
View File
@@ -31,7 +31,16 @@ gulp.task('inlineHtml', ['clean', 'browserify'], function() {
jsSelector: 'script[uglify]' jsSelector: 'script[uglify]'
})) }))
.pipe(minifyHTML()) .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']);
+1 -1
View File
@@ -1,6 +1,6 @@
'use strict'; 'use strict';
var configPageHtml = require('./dist/config-page.html'); var configPageHtml = require('./tmp/config-page.html');
function encodeDataUri(input) { function encodeDataUri(input) {
if (window.btoa) { if (window.btoa) {
+2 -9
View File
@@ -4,8 +4,6 @@ var browserify = require('browserify');
var source = require('vinyl-source-stream'); var source = require('vinyl-source-stream');
var gulp = require('gulp'); var gulp = require('gulp');
var path = require('path'); var path = require('path');
var template = require('gulp-template');
var stringify = require('stringify');
var del = require('del'); var del = require('del');
var projectPath = process.argv[2] || process.cwd(); var projectPath = process.argv[2] || process.cwd();
@@ -19,16 +17,11 @@ gulp.task('clean', function() {
return del([pebbleJsPath]); return del([pebbleJsPath]);
}); });
gulp.task('build', ['clean', 'pebble-js-app'], function() { gulp.task('pebble-js-app', ['clean'], function() {
});
gulp.task('pebble-js-app', function() {
browserify(clayJsPath, { debug: false }) browserify(clayJsPath, { debug: false })
.transform(stringify(['.html', '.mustache']))
.bundle() .bundle()
.pipe(source('pebble-js-app.js')) .pipe(source('pebble-js-app.js'))
.pipe(gulp.dest('./src/js/')); .pipe(gulp.dest('./src/js/'));
}); });
gulp.start('build'); gulp.start('pebble-js-app');
+4 -2
View File
@@ -2,12 +2,13 @@
"name": "pebble-clay", "name": "pebble-clay",
"version": "1.0.0", "version": "1.0.0",
"description": "Pebble Config Framework", "description": "Pebble Config Framework",
"main": "index.js", "main": "dist/clay.js",
"directories": { "directories": {
"example": "example" "example": "example"
}, },
"scripts": { "scripts": {
"test": "mocha" "test": "mocha",
"build": "gulp"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@@ -33,6 +34,7 @@
"browserify-mustache": "0.0.4", "browserify-mustache": "0.0.4",
"del": "^2.0.2", "del": "^2.0.2",
"gulp": "^3.9.0", "gulp": "^3.9.0",
"gulp-html-to-js": "0.0.1",
"gulp-inline": "0.0.15", "gulp-inline": "0.0.15",
"gulp-minify-html": "^1.0.4", "gulp-minify-html": "^1.0.4",
"gulp-minify-inline": "^0.1.1", "gulp-minify-inline": "^0.1.1",
+1 -1
View File
@@ -15,6 +15,6 @@
<body> <body>
<form id="main-form"></form> <form id="main-form"></form>
<script src="../vendor/pebble-slate/dist/js/slate.min.js"></script> <script src="../vendor/pebble-slate/dist/js/slate.min.js"></script>
<script uglify src="../tmp/config-page.js"></script> <script src="../tmp/config-page.js"></script>
</body> </body>
</html> </html>