Skip to content

Commit

Permalink
added grunt for compiling LESS and auto-prefixing CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
d13 committed Mar 19, 2015
1 parent 9d16f9a commit 6670234
Show file tree
Hide file tree
Showing 12 changed files with 108 additions and 90 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
## Directory-based project format
.idea/

node_modules
72 changes: 72 additions & 0 deletions GruntFile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
var path = require('path');


var appContext = {
paths: {
scripts: {

},
styles: {
root: './assets/styles/'
}
}
};

module.exports = function(grunt) {

var tasks = {
styles: ['less', 'autoprefixer'],
watch: ['watch'],
all: ['less', 'autoprefixer']
};
tasks.all = [].concat(tasks.styles, tasks.scripts);

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

less: {
options: {
compress: true,
sourceMap: true,
sourceMapFilename: appContext.paths.styles.root + 'site.css.map'
},
files: {
src: [ appContext.paths.styles.root + 'site.less' ],
dest: appContext.paths.styles.root + 'site.css'
}
},

autoprefixer: {

options: {
browsers: ['last 8 versions', 'ie 8', 'ie 9']
},

single_file: {
options: {},
src: appContext.paths.styles.root + 'site.css',
dest: appContext.paths.styles.root + 'site.css'
},
sourcemap: {
options: {
map: true
}
}
},
watch: {
css: {
files: '**/*.less',
tasks: tasks.styles
}
}
});

grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.loadNpmTasks('grunt-contrib-watch');


grunt.registerTask('styles', tasks.styles);
grunt.registerTask('watcher', tasks.watch);
grunt.registerTask('default', tasks.all);
};
16 changes: 7 additions & 9 deletions assets/styles/components/animations.less
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
@-webkit-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@-moz-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

.animation-fade-in {
// make things invisible upon start
opacity: 0;

// call our keyframe named fadeIn, use animation ease-in and repeat it only 1 time
.animation(fadeIn ease-in 1);
animation: fadeIn ease-in 1;

// this makes sure that after animation is done we remain at the last keyframe value (opacity: 1)
.animation-fill-mode(forwards);
animation-fill-mode: forwards;

.animation-duration(0.5s);
animation-duration: 0.5s;
}

.animation-delay-1 {
.animation-delay(0.7s);
animation-delay: 0.7s;
}
.animation-delay-2 {
.animation-delay(1.2s);
animation-delay: 1.2s;
}
.animation-delay-3 {
.animation-delay(1.6s);
animation-delay: 1.6s;
}
2 changes: 1 addition & 1 deletion assets/styles/components/base.less
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
html {
font-family: @base-font-family;
.text-size-adjust(100%);
text-size-adjust: 100%;
}

img {
Expand Down
2 changes: 1 addition & 1 deletion assets/styles/components/page-header.less
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
background-color: #d4d8dc;
position: fixed;
.animation-fade-in;
.animation-delay(0.4s);
animation-delay: 0.4s;

.site-brand--header {
height: 75px;
Expand Down
2 changes: 1 addition & 1 deletion assets/styles/components/reset.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

// EXTENDED RESETS
*, *:before, *:after {
.box-sizing(border-box);
box-sizing: border-box;
}
2 changes: 1 addition & 1 deletion assets/styles/components/section.less
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
.section {
padding-top: 75px;
padding-bottom: 75px;
.box-shadow(inset 0 -30px 30px -30px rgba(0, 0, 0, 0.2));
box-shadow: inset 0 -30px 30px -30px rgba(0, 0, 0, 0.2);
border-bottom: none;
}
.section--hero {
Expand Down
1 change: 0 additions & 1 deletion assets/styles/mixins/mixins.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "vendors.less";
@import "utilities.less";
@import "grid.less";
@import "nav.less";
Expand Down
73 changes: 0 additions & 73 deletions assets/styles/mixins/vendors.less

This file was deleted.

4 changes: 2 additions & 2 deletions assets/styles/site.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/styles/site.css.map

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "keithdaulton.com",
"version": "0.0.1",
"description": "Parsonal website of Keith Daulton",
"repository": {
"type": "git",
"url": "https://github.com/d13/keithdaulton.com.git"
},
"author": "Keith Daulton",
"private": true,
"scripts": {
"build": "grunt all"
},
"devDependencies": {
"grunt": "^0.4.5",
"grunt-autoprefixer": "^2.2.0",
"grunt-contrib-less": "^1.0.0",
"grunt-contrib-watch": "^0.6.1"
}
}

0 comments on commit 6670234

Please sign in to comment.