An easy starter boilerplate for static websites, to get you up and coding quickly. Uses Gulp and BrowserSync for local development, Sass for preprocessing, and Pug for templating π₯
Clone repo and cd into project directory:
git clone git@github.com:melanieseltzer/static-frontend-boilerplate.git
cd static-frontend-boilerplate
Install dependencies:
npm install
Serve locally from tmp
. BrowserSync watches for changes in src
and automatically reloads the browser:
gulp serve
Build the dist
directory for deployment:
gulp build
Deploy dist
directory to GitHub Pages (gh-pages branch):
gulp deploy
Delete tmp
and dist
folders for easy cleanup:
gulp clean (both)
gulp clean:tmp
gulp clean:dist
Develop your site in the src
directory. Production code is built to dist
. Dev server runs from tmp
. It is not intended to be committed to the repo (it's deleted automatically on production build), but commit it if you wish.
static-frontend-boilerplate/
|ββ dist/
| |ββ assets/
| | |ββ img/
| | | |ββ # optimized images
| | |ββ fonts/
| | |ββ pdfs/
| | |ββ etc...
| |ββ css/
| | |ββ all.css (packaged and minified)
| | |ββ all.css.gz (gzip compression)
| |ββ js/
| | |ββ all.js (packaged and minified)
| | |ββ all.js.gz (gzip compression)
| |ββ test-directory/
| | |ββ index.html
| | |ββ index.html.gz (gzip compression)
| |ββ index.html
| |ββ index.html.gz (gzip compression)
|ββ src/
| |ββ assets/
| | |ββ img/
| | | |ββ # unoptimized images
| | |ββ fonts/
| | |ββ pdfs/
| | |ββ etc...
| |ββ js/
| | |ββ all.js
| |ββ styles/
| | |ββ base/
| | |ββ components/
| | |ββ helpers/
| | |ββ layout/
| | |ββ pages/
| | |ββ all.scss
| |ββ views/
| | |ββ includes/
| | | |ββ _footer.pug
| | | |ββ _header.pug
| | | |ββ _scripts.pug
| | | |ββ _styles.pug
| | |ββ layouts/
| | | |ββ _default.pug
| | |ββ test-directory/
| | | |ββ index.pug
| | |ββ index.pug
|ββ tmp/
| |ββ assets/
| | |ββ img/
| | | |ββ # unoptimized images
| | |ββ fonts/
| | |ββ pdfs/
| | |ββ etc...
| |ββ css/
| | |ββ all.css
| | |ββ all.css.map
| |ββ js/
| | |ββ all.js
| | |ββ all.js.map
| |ββ test-directory/
| | |ββ index.html
| |ββ index.html
|ββ .gitignore
|ββ gulfile.js
|ββ LICENSE
|ββ package-lock.json
|ββ package.json
|ββ README.md
Set your paths. You can modify depending on your workflow/naming conventions.
var paths = {
vendor: {
css: [
'./node_modules/normalize.css',
'./node_modules/bootstrap/dist/css',
etc...
],
js: [
'./node_modules/jquery/dist',
'./node_modules/popper.js/dist/umd',
'./node_modules/bootstrap/dist/js',
etc...
]
},
assets: {
src: 'src/assets/**/*',
tmp: 'tmp/assets',
dist: 'dist/assets'
},
js: {
src: 'src/js/**/*.js',
tmp: 'tmp/js',
dist: 'dist/js'
},
styles: {
src: 'src/styles/**/*.{css,scss,sass}',
tmp: 'tmp/css',
dist: 'dist/css'
},
views: {
src: 'src/views/**/*.pug',
_src: 'src/views/**/!(_)*.pug'
},
html: {
src: 'tmp/**/*.html'
},
src: 'src',
tmp: 'tmp',
dist: 'dist'
};
This project is licensed under the MIT License - see the LICENSE file for details