Skip to content

Commit 9066bbf

Browse files
committed
🆕 bootstrap application
0 parents  commit 9066bbf

20 files changed

+1650
-0
lines changed

.babelrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"presets": ["es2015"],
3+
"compact": false
4+
}

.bowerrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory": "bower_components"
3+
}

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.DS_Store
2+
node_modules
3+
npm-debug.log
4+
bower_components
5+
dist
6+
*.swp

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
## Version 1.0 (November 19, 2015)
4+
5+
Initial release.

bower.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "foundation-ssg",
3+
"version": "1.0.0",
4+
"authors": [
5+
6+
],
7+
"description": "Static site generator for Foundation for Sites.",
8+
"main": "gulpfile.js",
9+
"license": "MIT",
10+
"ignore": [
11+
"**/.*",
12+
"node_modules",
13+
"bower_components",
14+
"test",
15+
"tests"
16+
],
17+
"dependencies": {
18+
"foundation-sites": "~6.3.0",
19+
"motion-ui": "~1.2.2"
20+
},
21+
"private": true
22+
}

config.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Your project's server will run on localhost:xxxx at this port
2+
PORT: 8000
3+
4+
# Autoprefixer will make sure your CSS works with these browsers
5+
COMPATIBILITY:
6+
- "last 2 versions"
7+
- "ie >= 9"
8+
- "ios >= 7"
9+
10+
# UnCSS will use these settings
11+
UNCSS_OPTIONS:
12+
html:
13+
- "src/**/*.html"
14+
ignore:
15+
- !!js/regexp .foundation-mq
16+
- !!js/regexp ^\.is-.*
17+
18+
# Gulp will reference these paths when it copies files
19+
PATHS:
20+
# Path to dist folder
21+
dist: "dist"
22+
# Paths to static assets that aren't images, CSS, or JavaScript
23+
assets:
24+
- "src/assets/**/*"
25+
- "!src/assets/{img,js,scss}/**/*"
26+
# Paths to Sass libraries, which can then be loaded with @import
27+
sass:
28+
- "bower_components/foundation-sites/scss"
29+
- "bower_components/motion-ui/src"
30+
# Paths to JavaScript libraries, which are combined into one file
31+
javascript:
32+
# Libraries required by Foundation
33+
- "bower_components/jquery/dist/jquery.js"
34+
- "bower_components/what-input/dist/what-input.js"
35+
# Core Foundation files
36+
- "bower_components/foundation-sites/js/foundation.core.js"
37+
- "bower_components/foundation-sites/js/foundation.util.*.js"
38+
# Individual Foundation components
39+
# If you aren't using a component, just remove it from the list
40+
- "bower_components/foundation-sites/js/foundation.abide.js"
41+
- "bower_components/foundation-sites/js/foundation.accordion.js"
42+
- "bower_components/foundation-sites/js/foundation.accordionMenu.js"
43+
- "bower_components/foundation-sites/js/foundation.drilldown.js"
44+
- "bower_components/foundation-sites/js/foundation.dropdown.js"
45+
- "bower_components/foundation-sites/js/foundation.dropdownMenu.js"
46+
- "bower_components/foundation-sites/js/foundation.equalizer.js"
47+
- "bower_components/foundation-sites/js/foundation.interchange.js"
48+
- "bower_components/foundation-sites/js/foundation.magellan.js"
49+
- "bower_components/foundation-sites/js/foundation.offcanvas.js"
50+
- "bower_components/foundation-sites/js/foundation.orbit.js"
51+
- "bower_components/foundation-sites/js/foundation.responsiveMenu.js"
52+
- "bower_components/foundation-sites/js/foundation.responsiveToggle.js"
53+
- "bower_components/foundation-sites/js/foundation.reveal.js"
54+
- "bower_components/foundation-sites/js/foundation.slider.js"
55+
- "bower_components/foundation-sites/js/foundation.sticky.js"
56+
- "bower_components/foundation-sites/js/foundation.tabs.js"
57+
- "bower_components/foundation-sites/js/foundation.toggler.js"
58+
- "bower_components/foundation-sites/js/foundation.tooltip.js"
59+
- "bower_components/foundation-sites/js/foundation.zf.responsiveAccordionTabs.js"
60+
# Paths to your own project code are here
61+
- "src/assets/js/!(app).js"
62+
- "src/assets/js/app.js"

gulpfile.babel.js

+142
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
'use strict';
2+
3+
import plugins from 'gulp-load-plugins';
4+
import yargs from 'yargs';
5+
import browser from 'browser-sync';
6+
import gulp from 'gulp';
7+
import panini from 'panini';
8+
import rimraf from 'rimraf';
9+
import sherpa from 'style-sherpa';
10+
import yaml from 'js-yaml';
11+
import fs from 'fs';
12+
13+
// Load all Gulp plugins into one variable
14+
const $ = plugins();
15+
16+
// Check for --production flag
17+
const PRODUCTION = !!(yargs.argv.production);
18+
19+
// Load settings from settings.yml
20+
const { COMPATIBILITY, PORT, UNCSS_OPTIONS, PATHS } = loadConfig();
21+
22+
function loadConfig() {
23+
let ymlFile = fs.readFileSync('config.yml', 'utf8');
24+
return yaml.load(ymlFile);
25+
}
26+
27+
// Build the "dist" folder by running all of the below tasks
28+
gulp.task('build',
29+
gulp.series(clean, gulp.parallel(pages, sass, javascript, images, copy), styleGuide));
30+
31+
// Build the site, run the server, and watch for file changes
32+
gulp.task('default',
33+
gulp.series('build', server, watch));
34+
35+
// Delete the "dist" folder
36+
// This happens every time a build starts
37+
function clean(done) {
38+
rimraf(PATHS.dist, done);
39+
}
40+
41+
// Copy files out of the assets folder
42+
// This task skips over the "img", "js", and "scss" folders, which are parsed separately
43+
function copy() {
44+
return gulp.src(PATHS.assets)
45+
.pipe(gulp.dest(PATHS.dist + '/assets'));
46+
}
47+
48+
// Copy page templates into finished HTML files
49+
function pages() {
50+
return gulp.src('src/pages/**/*.{html,hbs,handlebars}')
51+
.pipe(panini({
52+
root: 'src/pages/',
53+
layouts: 'src/layouts/',
54+
partials: 'src/partials/',
55+
data: 'src/data/',
56+
helpers: 'src/helpers/'
57+
}))
58+
.pipe(gulp.dest(PATHS.dist));
59+
}
60+
61+
// Load updated HTML templates and partials into Panini
62+
function resetPages(done) {
63+
panini.refresh();
64+
done();
65+
}
66+
67+
// Generate a style guide from the Markdown content and HTML template in styleguide/
68+
function styleGuide(done) {
69+
sherpa('src/styleguide/index.md', {
70+
output: PATHS.dist + '/styleguide.html',
71+
template: 'src/styleguide/template.html'
72+
}, done);
73+
}
74+
75+
// Compile Sass into CSS
76+
// In production, the CSS is compressed
77+
function sass() {
78+
return gulp.src('src/assets/scss/app.scss')
79+
.pipe($.sourcemaps.init())
80+
.pipe($.sass({
81+
includePaths: PATHS.sass
82+
})
83+
.on('error', $.sass.logError))
84+
.pipe($.autoprefixer({
85+
browsers: COMPATIBILITY
86+
}))
87+
// Comment in the pipe below to run UnCSS in production
88+
//.pipe($.if(PRODUCTION, $.uncss(UNCSS_OPTIONS)))
89+
.pipe($.if(PRODUCTION, $.cssnano()))
90+
.pipe($.if(!PRODUCTION, $.sourcemaps.write()))
91+
.pipe(gulp.dest(PATHS.dist + '/assets/css'))
92+
.pipe(browser.reload({ stream: true }));
93+
}
94+
95+
// Combine JavaScript into one file
96+
// In production, the file is minified
97+
function javascript() {
98+
return gulp.src(PATHS.javascript)
99+
.pipe($.sourcemaps.init())
100+
.pipe($.babel({ignore: ['what-input.js']}))
101+
.pipe($.concat('app.js'))
102+
.pipe($.if(PRODUCTION, $.uglify()
103+
.on('error', e => { console.log(e); })
104+
))
105+
.pipe($.if(!PRODUCTION, $.sourcemaps.write()))
106+
.pipe(gulp.dest(PATHS.dist + '/assets/js'));
107+
}
108+
109+
// Copy images to the "dist" folder
110+
// In production, the images are compressed
111+
function images() {
112+
return gulp.src('src/assets/img/**/*')
113+
.pipe($.if(PRODUCTION, $.imagemin({
114+
progressive: true
115+
})))
116+
.pipe(gulp.dest(PATHS.dist + '/assets/img'));
117+
}
118+
119+
// Start a server with BrowserSync to preview the site in
120+
function server(done) {
121+
browser.init({
122+
server: PATHS.dist, port: PORT
123+
});
124+
done();
125+
}
126+
127+
// Reload the browser with BrowserSync
128+
function reload(done) {
129+
browser.reload();
130+
done();
131+
}
132+
133+
// Watch for changes to static assets, pages, Sass, and JavaScript
134+
function watch() {
135+
gulp.watch(PATHS.assets, copy);
136+
gulp.watch('src/pages/**/*.html').on('all', gulp.series(pages, browser.reload));
137+
gulp.watch('src/{layouts,partials}/**/*.html').on('all', gulp.series(resetPages, pages, browser.reload));
138+
gulp.watch('src/assets/scss/**/*.scss').on('all', sass);
139+
gulp.watch('src/assets/js/**/*.js').on('all', gulp.series(javascript, browser.reload));
140+
gulp.watch('src/assets/img/**/*').on('all', gulp.series(images, browser.reload));
141+
gulp.watch('src/styleguide/**').on('all', gulp.series(styleGuide, browser.reload));
142+
}

package.json

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "foundation-zurb-template",
3+
"version": "1.0.0",
4+
"description": "Official ZURB Template for Foundation for Sites.",
5+
"main": "gulpfile.js",
6+
"scripts": {
7+
"start": "gulp",
8+
"build": "gulp build --production"
9+
},
10+
"author": "ZURB <[email protected]>",
11+
"license": "MIT",
12+
"devDependencies": {
13+
"babel-preset-es2015": "^6.3.13",
14+
"babel-register": "^6.7.2",
15+
"browser-sync": "^2.10.0",
16+
"gulp": "gulpjs/gulp#4.0",
17+
"gulp-autoprefixer": "^3.1.0",
18+
"gulp-babel": "^6.1.2",
19+
"gulp-cli": "^1.2.1",
20+
"gulp-concat": "^2.5.2",
21+
"gulp-cssnano": "^2.1.0",
22+
"gulp-extname": "^0.2.0",
23+
"gulp-if": "^2.0.0",
24+
"gulp-imagemin": "^2.2.1",
25+
"gulp-load-plugins": "^1.1.0",
26+
"gulp-sass": "^2.1.0",
27+
"gulp-sourcemaps": "^1.6.0",
28+
"gulp-uglify": "^1.2.0",
29+
"gulp-uncss": "^1.0.1",
30+
"js-yaml": "^3.4.6",
31+
"panini": "^1.3.0",
32+
"rimraf": "^2.4.3",
33+
"style-sherpa": "^1.0.0",
34+
"yargs": "^3.8.0"
35+
},
36+
"repository": {
37+
"type": "git",
38+
"url": "https://github.com/zurb/foundation-zurb-template.git"
39+
},
40+
"bugs": {
41+
"url": "https://github.com/zurb/foundation-sites/issues",
42+
"email": "[email protected]"
43+
},
44+
"babel": {
45+
"presets": ["es2015"]
46+
},
47+
"private": true
48+
}

readme.md

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# ZURB Template
2+
3+
[![devDependency Status](https://david-dm.org/zurb/foundation-zurb-template/dev-status.svg)](https://david-dm.org/zurb/foundation-zurb-template#info=devDependencies)
4+
5+
**Please open all issues with this template on the main [Foundation for Sites](https://github.com/zurb/foundation-sites/issues) repo.**
6+
7+
This is the official ZURB Template for use with [Foundation for Sites](http://foundation.zurb.com/sites). We use this template at ZURB to deliver static code to our clients. It has a Gulp-powered build system with these features:
8+
9+
- Handlebars HTML templates with Panini
10+
- Sass compilation and prefixing
11+
- JavaScript concatenation
12+
- Built-in BrowserSync server
13+
- For production builds:
14+
- CSS compression
15+
- JavaScript compression
16+
- Image compression
17+
18+
## Installation
19+
20+
To use this template, your computer needs:
21+
22+
- [NodeJS](https://nodejs.org/en/) (0.12 or greater)
23+
- [Git](https://git-scm.com/)
24+
25+
This template can be installed with the Foundation CLI, or downloaded and set up manually.
26+
27+
### Using the CLI
28+
29+
Install the Foundation CLI with this command:
30+
31+
```bash
32+
npm install foundation-cli --global
33+
```
34+
35+
Use this command to set up a blank Foundation for Sites project with this template:
36+
37+
```bash
38+
foundation new --framework sites --template zurb
39+
```
40+
41+
The CLI will prompt you to give your project a name. The template will be downloaded into a folder with this name.
42+
43+
### Manual Setup
44+
45+
To manually set up the template, first download it with Git:
46+
47+
```bash
48+
git clone https://github.com/zurb/foundation-zurb-template projectname
49+
```
50+
51+
Then open the folder in your command line, and install the needed dependencies:
52+
53+
```bash
54+
cd projectname
55+
npm install
56+
bower install
57+
```
58+
59+
Finally, run `npm start` to run Gulp. Your finished site will be created in a folder called `dist`, viewable at this URL:
60+
61+
```
62+
http://localhost:8000
63+
```
64+
65+
To create compressed, production-ready assets, run `npm run build`.

src/assets/img/.gitkeep

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# You can delete this file. It's just here to make Git happy.

src/assets/js/app.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
$(document).foundation();

0 commit comments

Comments
 (0)