Skip to content

Commit 0b3fd6d

Browse files
author
Kurt Roberts
committed
initial commit
0 parents  commit 0b3fd6d

28 files changed

+614
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
dist
3+
.DS_Store

.jshintrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"undef": true,
3+
"unused": true,
4+
"predef": [
5+
"_"
6+
],
7+
"browser": true,
8+
"jquery": true,
9+
"node": true,
10+
"devel": true,
11+
"globals": {
12+
"RP3": true
13+
}
14+
}

LICENSE

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
MIT License
2+
3+
Copyright (c) 2017 RP3 Agency
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# RP3's Prototype Build Kit
2+
3+
This is our opinion of what you need to start prototyping in code. We've pre-configured SCSS, HTML Extender, EJS, Markdown rendering, BrowserSync and more.
4+
5+
## Getting started
6+
7+
1. Open `gulpfile.js` in a text editor of your choice and set all the config options marked with a `//TODO:`
8+
2. `npm install`
9+
3. `gulp`
10+
4. Start making things!

gulpfile.js

Lines changed: 253 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
//TODO: set your AWS profile
2+
process.env.AWS_PROFILE = 'SET YOUR PROFILE HERE';
3+
4+
var fs = require('fs'),
5+
path = require('path'),
6+
gulp = require('gulp'),
7+
sass = require('gulp-sass'),
8+
sourcemaps = require('gulp-sourcemaps'),
9+
autoprefixer = require('gulp-autoprefixer'),
10+
filter = require('gulp-filter'),
11+
removeHtmlComments = require('gulp-remove-html-comments'),
12+
browserSync = require('browser-sync').create(),
13+
reload = browserSync.reload,
14+
watch = require('gulp-watch'),
15+
del = require('del'),
16+
jshint = require('gulp-jshint'),
17+
markdown = require('gulp-markdown'),
18+
wrap = require('gulp-wrap'),
19+
extender = require('gulp-html-extend'),
20+
ejs = require('gulp-ejs'),
21+
//TODO: set your region
22+
aws_s3 = require('gulp-s3-upload')({ useIAM: true }, { region: '' }),
23+
slack = require('gulp-slack')({
24+
url: '', //from slack interface
25+
icon_url: 'http://purefishing.scene7.com/is/image/purefishing/1109403',
26+
user: 'Gulp',
27+
channel: '' //from your Slack instance
28+
}),
29+
username = require('username'),
30+
user = username.sync(),
31+
paths = {
32+
src : {
33+
base : __dirname + '/src',
34+
sass : __dirname + '/src/sass',
35+
js : __dirname + '/src/js',
36+
images : __dirname + '/src/images',
37+
vendor : __dirname + '/src/vendor',
38+
fonts : __dirname + '/src/css/fonts',
39+
},
40+
dist : {
41+
base : __dirname + '/build',
42+
css : __dirname + '/build/css',
43+
js : __dirname + '/build/js',
44+
images : __dirname + '/build/images',
45+
vendor : __dirname + '/build/vendor',
46+
fonts : __dirname + '/build/css/fonts',
47+
}
48+
},
49+
mdTemplate = '<!-- @@master /_templates/main.html { "title": "Home Page" } -->\n<!-- @@block content -->\n<%= contents %>\n<!-- @@close -->',
50+
environments = {
51+
qc: 'qc.prototype.example.support',
52+
uat: 'uat.prototype.example.support',
53+
prod: 'example.com'
54+
};
55+
56+
57+
/*****
58+
59+
Lifecycle Management
60+
61+
*****/
62+
63+
//Clean
64+
65+
gulp.task('clean', function (cb) {
66+
del([
67+
paths.dist.base + '/**',
68+
'!' + paths.dist.base,
69+
], cb);
70+
});
71+
72+
73+
74+
75+
//Build
76+
77+
78+
gulp.task('md', function () {
79+
return gulp.src([
80+
paths.src.base + '/**/*.md',
81+
'!' + paths.src.base + '/_templates/**',
82+
'!' + paths.src.base + '/_components/**',
83+
'!' + paths.src.base + '/html/**/_*.md'
84+
])
85+
.pipe(markdown())
86+
.pipe(wrap(mdTemplate, {}, { parse: false}))
87+
.pipe(extender({
88+
annotations: false,
89+
verbose: false,
90+
root: '/src/'
91+
}))
92+
.pipe(removeHtmlComments())
93+
.pipe(gulp.dest(paths.dist.base))
94+
.pipe(reload({stream: true}));
95+
});
96+
97+
98+
99+
gulp.task('html', function(){
100+
return gulp.src([
101+
paths.src.base + '/**/*.html',
102+
'!' + paths.src.base + '/_templates/**',
103+
'!' + paths.src.base + '/_components/**',
104+
'!' + paths.src.base + '/html/**/_*.html'
105+
])
106+
.pipe(extender({
107+
annotations: false,
108+
verbose: false,
109+
root: '/src/'
110+
}))
111+
.pipe(ejs())
112+
.pipe(removeHtmlComments())
113+
.pipe(gulp.dest(paths.dist.base))
114+
.pipe(reload({stream: true}));
115+
});
116+
117+
gulp.task('styles', function () {
118+
return gulp.src(paths.src.sass + '/site.scss')
119+
.pipe(sourcemaps.init()) // source map init
120+
.pipe(sass()) // Sass
121+
.pipe(autoprefixer('last 2 version'))
122+
.pipe(sourcemaps.write()) // sourcemap write
123+
.pipe(gulp.dest( paths.dist.css )) // save css file
124+
.pipe(filter('**/*.css')) // filter only css files (remove the map file)
125+
.pipe(reload({stream: true})); // inject the changed css
126+
});
127+
128+
gulp.task('images', function () {
129+
return gulp.src(paths.src.images + '/**/*',{ allowEmpty: true })
130+
.pipe(gulp.dest(paths.dist.images));
131+
});
132+
133+
gulp.task('js', function () {
134+
return gulp.src(paths.src.js + '/**/*.js',{ allowEmpty: true })
135+
.pipe(jshint(__dirname + '/.jshintrc'))
136+
.pipe(jshint.reporter('default'))
137+
.pipe(gulp.dest(paths.dist.js));
138+
});
139+
140+
gulp.task('fonts', function () {
141+
return gulp.src(paths.src.fonts + '/**/*',{ allowEmpty: true })
142+
.pipe(gulp.dest(paths.dist.fonts));
143+
});
144+
145+
gulp.task('vendor', function () {
146+
return gulp.src(paths.src.vendor + '/**/*',{ allowEmpty: true })
147+
.pipe(gulp.dest(paths.dist.vendor));
148+
});
149+
150+
gulp.task('copy', ['images', 'js', 'fonts', 'vendor']);
151+
152+
153+
//Develop
154+
155+
gulp.task('bs', function (cb) {
156+
browserSync.init({
157+
server: {
158+
baseDir: paths.dist.base,
159+
index: 'index.html'
160+
},
161+
port : 3000,
162+
open : 'external',
163+
host : 'localhost',
164+
notify: {
165+
styles: [
166+
'display: none;',
167+
'padding: 7px 15px;',
168+
'border-radius: 0 0 3px 3px;',
169+
'position: fixed;',
170+
'font-family: Arial, sans-serif',
171+
'font-size: 14px;',
172+
'font-weight: normal;',
173+
'z-index: 9999;',
174+
'right: 0px;',
175+
'top: 0px;',
176+
'background-color: rgba(30, 30, 30, .7);',
177+
'color: #fff',
178+
'pointer-events: none;'
179+
]
180+
},
181+
ghostMode: {
182+
clicks: true,
183+
scroll: true,
184+
forms: {
185+
submit: true,
186+
inputs: true,
187+
toggles: true
188+
}
189+
}
190+
}, function(err, bs) {
191+
cb()
192+
});
193+
});
194+
195+
gulp.task('reload', function (cb) {
196+
reload();
197+
cb();
198+
});
199+
200+
gulp.task('watch', function (cb) {
201+
gulp.watch([paths.src.sass + '/**/*'], ['styles']);
202+
gulp.watch([paths.src.js + '/**/*'], ['js']);
203+
gulp.watch([paths.src.images + '/**/*'], ['images']);
204+
gulp.watch([paths.src.vendor + '/**/*'], ['vendor']);
205+
gulp.watch([paths.src.base + '/**/*.html'], ['html']);
206+
cb();
207+
});
208+
209+
gulp.task('build', ['styles', 'copy', 'html', 'md']);
210+
211+
gulp.task('serve', ['bs', 'build']);
212+
213+
214+
//Deploy
215+
216+
//Deploy
217+
gulp.task('deploy-qc', ['build'], function () {
218+
console.log('Not configured');
219+
return 0;
220+
return gulp.src(paths.dist.base + '/**')
221+
.pipe(aws_s3({
222+
Bucket: environments.qc,
223+
ACL: 'public-read'
224+
}))
225+
.pipe(slack('Deployed to QC environment by ' + user + '.'));
226+
});
227+
228+
//TODO: Implement Staging Deploy
229+
gulp.task('deploy-uat', ['build'], function () {
230+
console.log('Not configured');
231+
return 0;
232+
return gulp.src(paths.dist.base + '/**')
233+
.pipe(aws_s3({
234+
Bucket: environments.uat,
235+
ACL: 'public-read'
236+
}))
237+
.pipe(slack('Deployed to UAT environment by ' + user + '.'));
238+
});
239+
240+
//TODO: Implement Production Deploy
241+
gulp.task('deploy-prod', ['build'], function () {
242+
console.log('Not configured');
243+
return 0;
244+
return gulp.src(paths.dist.base + '/**')
245+
.pipe(aws_s3({
246+
Bucket: environments.prod,
247+
ACL: 'public-read'
248+
}))
249+
.pipe(slack('Deployed to PRODUCTION environment by ' + user + '.'));
250+
});
251+
252+
253+
gulp.task('default', ['serve', 'watch']);

package.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "PrototypeBuildKit",
3+
"version": "1.1.0",
4+
"description": "RP3's Prototype Build Kit, your starting point for builds of all kinds.",
5+
"dependencies": {},
6+
"devDependencies": {
7+
"browser-sync": "^2.17.5",
8+
"del": "^2.2.2",
9+
"gulp": "^3.9.1",
10+
"gulp-autoprefixer": "^3.1.1",
11+
"gulp-ejs": "^3.0.0",
12+
"gulp-filter": "~4.0.0",
13+
"gulp-html-extend": "^1.1.6",
14+
"gulp-jshint": "^2.0.4",
15+
"gulp-markdown": "^1.2.0",
16+
"gulp-remove-html-comments": "^1.0.1",
17+
"gulp-s3-upload": "^1.6.4",
18+
"gulp-sass": "^2.3.2",
19+
"gulp-slack": "^0.1.2",
20+
"gulp-sourcemaps": "~2.2.0",
21+
"gulp-watch": "^4.3.10",
22+
"gulp-wrap": "^0.13.0",
23+
"jshint": "^2.9.4",
24+
"username": "^2.3.0"
25+
},
26+
"scripts": {
27+
"test": "echo \"Error: no test specified\" && exit 1"
28+
},
29+
"author": "RP3 Agency",
30+
"license": "MIT"
31+
}

src/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# How To Use Markdown
2+
3+
Just make a file full of markdown. The build will automatically render it as html and stick it in the content section of your main.html template. There's a variable in the opening stanzas of the gulpfile, `mdTemplate`, that controls what wrapper is used around the rendered markdown.
4+
5+
- Make Bullet
6+
- Lists quickly
7+
- And prototype
8+
- Content too
9+
- With Markdown!!!

src/_components/footer.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<h1>The footer on every page.</h1>

src/_components/header.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<h1>The header on every page.</h1>

src/_components/index.html

Whitespace-only changes.

0 commit comments

Comments
 (0)