basic dev setup done

This commit is contained in:
Keegan
2016-01-06 17:28:34 -08:00
parent d23eff9949
commit 58a1a3f498
9 changed files with 173 additions and 8 deletions
+77
View File
@@ -0,0 +1,77 @@
'use strict';
/* eslint-disable quotes */
module.exports = [
{
"type": "section",
"items": [
{
"type": "heading",
"id": "main-heading",
"value": "My Cool App"
},
{
"type": "footer",
"value": "By Keegan Lillo - <a href=\"http://lillo.me\">Lillo.me</a>"
}
]
},
{
"type": "section",
"items": [
{
"type": "subheading",
"value": "Settings"
},
{
"type": "block",
"items": [
{
"type": "input",
"app_key": "greeting",
"value": "Hello",
"label": "Greeting",
"attributes": {
"placeholder": "Enter a \"greeting\"",
"limit": 10,
"required": "required"
}
},
{
"type": "toggle",
"app_key": "like_stuff",
"label": "Enable Cool Stuff",
"value": true
},
{
"id": "flavor",
"type": "select",
"app_key": "flavor",
"value": "grape",
"label": "Favorite Flavor",
"options": [
{ "label": "Berry", "value": "berry" },
{ "label": "Grape", "value": "grape" },
{ "label": "Banana", "value": "banana" }
]
},
{
"type": "color",
"app_key": "background",
"value": "0xFF0000",
"label": "Background Color"
}
]
}
]
},
{
"type": "section",
"items": [
{
"type": "submit",
"value": "Save"
}
]
}
];
+5
View File
@@ -0,0 +1,5 @@
'use strict';
module.exports = function() {
console.debug('custom fn worked');
};
+14
View File
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Pebble Clay Development Page</title>
<link rel="stylesheet" href="../tmp/config-page.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
</head>
<body>
<form id="main-form"></form>
<script src="../tmp/dev.js"></script>
<script src="../tmp/config-page.js"></script>
</body>
</html>
+6
View File
@@ -0,0 +1,6 @@
'use strict';
window.returnTo = '$$RETURN_TO$$';
window.clayConfig = require('./config.js');
window.claySettings = {};
window.customFn = require('./custom-fn.js');
+28 -6
View File
@@ -8,14 +8,14 @@ var del = require('del');
var inline = require('gulp-inline'); var inline = require('gulp-inline');
var minifyInline = require('gulp-minify-inline'); var minifyInline = require('gulp-minify-inline');
var minifyHTML = require('gulp-minify-html'); var minifyHTML = require('gulp-minify-html');
var sass = require('gulp-sass');
var sourceMaps = require('gulp-sourcemaps');
gulp.task('clean', function(done) { gulp.task('clean-js', function() {
del(['dist', 'tmp']).then(function() { return del(['tmp/config-page.js']);
done();
});
}); });
gulp.task('browserify', ['clean'], function() { gulp.task('js', ['clean-js'], function() {
return browserify('src/scripts/config-page.js', { debug: false }) return browserify('src/scripts/config-page.js', { debug: false })
.transform(stringify(['.html', '.mustache'])) .transform(stringify(['.html', '.mustache']))
.bundle() .bundle()
@@ -23,7 +23,18 @@ gulp.task('browserify', ['clean'], function() {
.pipe(gulp.dest('./tmp/')); .pipe(gulp.dest('./tmp/'));
}); });
gulp.task('inlineHtml', ['clean', 'browserify'], function() { gulp.task('clean-sass', function() {
return del(['tmp/config-page.scss']);
});
gulp.task('sass', ['clean-sass'], function() {
gulp.src('./src/styles/config-page.scss')
.pipe(sourceMaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(sourceMaps.write('./'))
.pipe(gulp.dest('tmp'));
});
gulp.task('inlineHtml', ['js', 'sass'], function() {
return gulp.src('src/config-page.html') return gulp.src('src/config-page.html')
.pipe(inline()) .pipe(inline())
.pipe(minifyInline({ .pipe(minifyInline({
@@ -44,3 +55,14 @@ gulp.task('clay', ['inlineHtml'], function() {
}); });
gulp.task('default', ['clay']); gulp.task('default', ['clay']);
gulp.task('dev', ['js', 'sass'], function() {
gulp.watch('./src/styles/', ['sass']);
gulp.watch('./src/scripts/', ['js']);
return browserify('dev/dev.js', { debug: true })
.bundle()
.pipe(source('dev.js'))
.pipe(gulp.dest('./tmp/'));
});
Executable → Regular
+3 -1
View File
@@ -27,7 +27,9 @@
"devDependencies": { "devDependencies": {
"eslint": "^1.5.1", "eslint": "^1.5.1",
"eslint-config-pebble": "^1.2.0", "eslint-config-pebble": "^1.2.0",
"eslint-plugin-standard": "^1.3.1" "eslint-plugin-standard": "^1.3.1",
"gulp-sass": "^2.1.1",
"gulp-sourcemaps": "^1.6.0"
}, },
"dependencies": { "dependencies": {
"browserify": "^11.2.0", "browserify": "^11.2.0",
+39
View File
@@ -0,0 +1,39 @@
[
{
"type": "static_title",
"text": "My Cool Example App"
},
{
"type": "static_heading1",
"text": "By Keegan Lillo - <a href='http://lillo.me'>Lillo.me</a>"
},
[
{
"type": "input_text",
"app_key": "greeting",
"default": "Hello",
"label": "Greeting",
"attributes": {
"placeholder": "Enter a greeting",
"limit": 10,
"required": true
}
},
{
"type": "input_select",
"app_key": "flavor",
"default": "grape",
"options": [
{ "label": "Berry", "value": "berry" },
{ "label": "Grape", "value": "grape" },
{ "label": "Banana", "value": "banana" }
]
},
{
"type": "input_color",
"app_key": "background",
"default": "0xFF0000",
"label": "Background Color"
}
]
]
+1 -1
View File
@@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<link rel="stylesheet" href="../vendor/pebble-slate/dist/css/slate.min.css"> <link rel="stylesheet" href="../vendor/pebble-slate/dist/css/slate.min.css">
<link rel="stylesheet" href="styles/config-page.css"> <link rel="stylesheet" href="../tmp/config-page.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<script> <script>
window.returnTo = '$$RETURN_TO$$'; window.returnTo = '$$RETURN_TO$$';