Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Motil authored and Eric Motil committed Nov 4, 2015
0 parents commit 15d3da3
Show file tree
Hide file tree
Showing 42 changed files with 401 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
@@ -0,0 +1,11 @@
# editorconfig.org

root = true

[*]
indent_style = tab
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
8 changes: 8 additions & 0 deletions .gitignore
@@ -0,0 +1,8 @@
# Dependency directories
node_modules
bower_components

# Compiled
dist
dist/**/*

150 changes: 150 additions & 0 deletions Gulpfile.js
@@ -0,0 +1,150 @@
'use strict';


// -----------------------------------------------------------------------------
// Dependencies
// -----------------------------------------------------------------------------

var gulp = require('gulp');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var sassdoc = require('sassdoc');
var browserSync = require('browser-sync').create();
var nunjucksRender = require('gulp-nunjucks-render');
var concat = require('gulp-concat');
var imagemin = require('gulp-imagemin');
var pngquant = require('imagemin-pngquant');
var siteOutput = './dist';


// -----------------------------------------------------------------------------
// Configuration
// -----------------------------------------------------------------------------

var input = './scss/*.scss';
var inputMain = './scss/main.scss';
var output = siteOutput + '/css';
var inputTemplates = './pages/*.html';
var sassOptions = { outputStyle: 'expanded' };
var autoprefixerOptions = { browsers: ['last 2 versions', '> 5%', 'Firefox ESR'] };
var sassdocOptions = { dest: siteOutput + '/sassdoc' };


// -----------------------------------------------------------------------------
// Sass compilation
// -----------------------------------------------------------------------------

gulp.task('sass', function() {
return gulp
.src(inputMain)
.pipe(sass(sassOptions).on('error', sass.logError))
.pipe(autoprefixer(autoprefixerOptions))
.pipe(gulp.dest(output))
.pipe(browserSync.stream());
});


// -----------------------------------------------------------------------------
// Javascript
// -----------------------------------------------------------------------------

gulp.task('scripts', function() {
return gulp.src([
'./bower_components/bootstrap-sass/assets/javascripts/bootstrap.js',
'js/main.js'
])
.pipe(concat({ path: 'main.js'}))
.pipe(browserSync.reload({stream:true}))
.pipe(gulp.dest(siteOutput + '/js'));
});


// -----------------------------------------------------------------------------
// Templating
// -----------------------------------------------------------------------------

gulp.task('nunjucks', function() {
nunjucksRender.nunjucks.configure(['./templates/']);
// Gets .html and .nunjucks files in pages
return gulp.src(inputTemplates)
// Renders template with nunjucks
.pipe(nunjucksRender())
// output files in dist folder
.pipe(gulp.dest(siteOutput))
});


// -----------------------------------------------------------------------------
// Imagemin
// -----------------------------------------------------------------------------

gulp.task('img', function() {
return gulp.src('./img/**/*')
.pipe(imagemin({
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [pngquant()]
}))
.pipe(gulp.dest(siteOutput + '/img'));
});


// -----------------------------------------------------------------------------
// Fonts
// -----------------------------------------------------------------------------

// gulp.task('fonts', function() {
// return gulp.src(['./fonts/*'])
// .pipe(gulp.dest(siteOutput + '/fonts/'));
// });


// -----------------------------------------------------------------------------
// Sass documentation generation
// -----------------------------------------------------------------------------

gulp.task('sassdoc', function() {
return gulp
.src(input)
.pipe(sassdoc(sassdocOptions))
.resume();
});


// -----------------------------------------------------------------------------
// Watchers
// -----------------------------------------------------------------------------

gulp.task('watch', function() {
// Watch the sass input folder for change,
// and run `sass` task when something happens
gulp.watch(input, ['sass']).on('change', function(event) {
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
});

gulp.watch('./js/*', ['scripts']).on('change', browserSync.reload);

// Watch nunjuck templates and reload browser if change
gulp.watch(inputTemplates, ['nunjucks']).on('change', browserSync.reload);

});


// -----------------------------------------------------------------------------
// Static server
// -----------------------------------------------------------------------------

gulp.task('browser-sync', function() {
browserSync.init({
server: {
baseDir: siteOutput
}
});
});


// -----------------------------------------------------------------------------
// Default task
// -----------------------------------------------------------------------------

gulp.task('default', ['sass', 'nunjucks', 'scripts', 'img', 'watch', 'browser-sync']);
38 changes: 38 additions & 0 deletions README.md
@@ -0,0 +1,38 @@
# SVMIC

A nice little Gulp project using [Nunjucks](http://mozilla.github.io/nunjucks/),[SASS](http://sass-lang.com/) and [Gulp](http://gulpjs.com/). Browsersync runs out of 'dist' folder and watches all Nunjucks templates, SASS and JS and live reloads in browser on change. Also worked in some img min and moving fonts and assets to a 'dist' folder for easy deployment.


Gulp tasks used:
- sass
- autoprefixer
- sassdoc
- browserSync
- nunjucksRender
- script concat
- imagemin
- pngquant


## Setup

1) Install [Gulp](http://gulpjs.com/) and [NPM]('http://nodejs.org') if you do not already have them.

2) Install npm dependencies
```
npm install
```

3) Install bower components
```
bower install
```

$) Run Gulp
```
gulp
```

Binary file added img/favicons/android-chrome-144x144.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicons/android-chrome-192x192.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicons/android-chrome-36x36.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicons/android-chrome-48x48.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicons/android-chrome-72x72.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicons/android-chrome-96x96.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicons/apple-touch-icon-114x114.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicons/apple-touch-icon-120x120.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicons/apple-touch-icon-144x144.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicons/apple-touch-icon-152x152.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicons/apple-touch-icon-180x180.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicons/apple-touch-icon-57x57.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicons/apple-touch-icon-60x60.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicons/apple-touch-icon-72x72.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicons/apple-touch-icon-76x76.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicons/apple-touch-icon-precomposed.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicons/apple-touch-icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions img/favicons/browserconfig.xml
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square70x70logo src="/mstile-70x70.png"/>
<square150x150logo src="/mstile-150x150.png"/>
<square310x310logo src="/mstile-310x310.png"/>
<wide310x150logo src="/mstile-310x150.png"/>
<TileColor>#da532c</TileColor>
</tile>
</msapplication>
</browserconfig>
Binary file added img/favicons/favicon-16x16.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicons/favicon-32x32.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicons/favicon-96x96.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicons/favicon.ico
Binary file not shown.
41 changes: 41 additions & 0 deletions img/favicons/manifest.json
@@ -0,0 +1,41 @@
{
"name": "svmic",
"icons": [
{
"src": "\/android-chrome-36x36.png",
"sizes": "36x36",
"type": "image\/png",
"density": "0.75"
},
{
"src": "\/android-chrome-48x48.png",
"sizes": "48x48",
"type": "image\/png",
"density": "1.0"
},
{
"src": "\/android-chrome-72x72.png",
"sizes": "72x72",
"type": "image\/png",
"density": "1.5"
},
{
"src": "\/android-chrome-96x96.png",
"sizes": "96x96",
"type": "image\/png",
"density": "2.0"
},
{
"src": "\/android-chrome-144x144.png",
"sizes": "144x144",
"type": "image\/png",
"density": "3.0"
},
{
"src": "\/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image\/png",
"density": "4.0"
}
]
}
Binary file added img/favicons/mstile-144x144.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicons/mstile-150x150.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicons/mstile-310x150.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicons/mstile-310x310.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicons/mstile-70x70.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions img/favicons/safari-pinned-tab.svg
Binary file added img/friday.gif
5 changes: 5 additions & 0 deletions js/main.js
@@ -0,0 +1,5 @@
// main.js

$(document).ready(function (){
console.log('document is ready bitch');
});
29 changes: 29 additions & 0 deletions package.json
@@ -0,0 +1,29 @@
{
"name": "svmic",
"version": "1.0.0",
"description": "svmic",
"main": "index.html",
"scripts": {
"test": "ok"
},
"repository": {
"type": "git",
"url": "nope"
},
"keywords": [
"insurance"
],
"author": "eric motil",
"license": "MIT",
"devDependencies": {
"browser-sync": "^2.9.11",
"gulp": "^3.9.0",
"gulp-autoprefixer": "^3.1.0",
"gulp-concat": "^2.6.0",
"gulp-imagemin": "^2.3.0",
"gulp-nunjucks-render": "^1.0.0",
"gulp-sass": "^2.1.0",
"imagemin-pngquant": "^4.2.0",
"sassdoc": "^2.1.15"
}
}
8 changes: 8 additions & 0 deletions pages/index.html
@@ -0,0 +1,8 @@
<!-- index.nunjucks -->
{% extends "default.html" %}
{% block content %}

<h1>Hello</h1>
<img src="/img/friday.gif" width="100%"/>

{% endblock %}
7 changes: 7 additions & 0 deletions scss/_base.scss
@@ -0,0 +1,7 @@
// base.scss

html, body {
height: 100%;
margin: 0;
padding: 0;
}
4 changes: 4 additions & 0 deletions scss/main.scss
@@ -0,0 +1,4 @@
// main.scss

// Imports
@import 'base';
13 changes: 13 additions & 0 deletions templates/default.html
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">

{% include "partials/head.html" %}

<body>

{% block content %}{% endblock %}

{% include "partials/end.html" %}

</body>
</html>
2 changes: 2 additions & 0 deletions templates/partials/end.html
@@ -0,0 +1,2 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="/js/main.js"></script>

0 comments on commit 15d3da3

Please sign in to comment.