Skip to content

Instantly share code, notes, and snippets.

@woeldiche woeldiche/myfiles
Created Sep 30, 2014

Embed
What would you like to do?
// Generated on 2013-11-11 using generator-webapp 0.4.4
/* jshint camelcase: false */
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
module.exports = function (grunt) {
// show elapsed time at the end
require('time-grunt')(grunt);
// load all grunt tasks
require('load-grunt-tasks')(grunt);
grunt.loadNpmTasks('assemble');
grunt.loadNpmTasks('grunt-modernizr');
grunt.loadNpmTasks('grunt-webfont');
grunt.loadNpmTasks('grunt-requirejs');
grunt.loadNpmTasks('grunt-mkdir');
grunt.loadNpmTasks('grunt-build-control');
grunt.loadNpmTasks('grunt-responsive-images');
grunt.loadNpmTasks('grunt-prettify');
grunt.loadNpmTasks('grunt-githooks');
grunt.loadNpmTasks('grunt-inline');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-bless');
grunt.initConfig({
bless: {
css: {
options: {},
files: {
'<%= yeoman.app %>/styles/main-blessed.css': '<%= yeoman.app %>/styles/main.css',
'<%= yeoman.app %>/styles/oldie-blessed.css': '<%= yeoman.app %>/styles/oldie.css',
'<%= yeoman.app %>/styles/styleguide-blessed.css': '<%= yeoman.app %>/styles/styleguide.css',
'<%= yeoman.app %>/styles/styleguide-oldie-blessed.css': '<%= yeoman.app %>/styles/styleguide-oldie.css'
}
}
},
assemble: {
options: {
helpers: [
'<%= yeoman.src %>/styleguide-src/handlebarshelpers/*.js'
],
docBase: '<%= yeoman.src %>/documentation',
sgComponent: {
cwd: '<%= yeoman.src %>/styleguide-src/layouts',
src: '<%= yeoman.src %>/src/partials'
}
},
styleguide: {
options: {
flatten: true,
layoutdir: '<%= yeoman.src %>/styleguide-src/layouts',
layout: false,
partials: [
'<%= yeoman.src %>/styleguide-src/navigation/*.hbs',
'<%= yeoman.src %>/styleguide-src/partials/*.hbs',
'<%= yeoman.src %>/styleguide-src/layouts/*.hbs',
'<%= yeoman.src %>/src/_framework/partials/**/*.hbs',
'<%= yeoman.src %>/src/partials/**/*.hbs',
'<%= yeoman.src %>/src/layouts/*.hbs',
'<%= yeoman.src %>/src/pages/{parts,proxy}/*.hbs'
],
data: ['<%= yeoman.src %>/src/data/*.{json,yml}', '<%= yeoman.app %>/styleguide-src/data/*.{json,yml}']
},
files: {
'<%= yeoman.tmp %>': [
'<%= yeoman.src %>/src/pages/{parts,proxy}/*.hbs'
]
}
},
htmlparts: {
options: {
flatten: true,
partials: [
'<%= yeoman.src %>/src/partials/**/*.hbs'
],
data: '<%= yeoman.src %>/src/data/*.{json,yml}'
},
files: {
'<%= yeoman.tmp %>/parts/': [
'<%= yeoman.src %>/src/pages/parts/*.hbs'
]
}
},
proxies: {
options: {
flatten: true,
partials: [
'<%= yeoman.src %>/src/partials/**/*.hbs'
],
data: '<%= yeoman.src %>/src/data/*.{json,yml}'
},
files: {
'<%= yeoman.tmp %>/proxy/': [
'<%= yeoman.src %>/src/pages/proxy/*.hbs'
]
}
}
},
autoprefixer: {
options: {
browsers: ['> 1%', 'last 2 versions', 'ff > 24', 'Opera 12.1'],
cascade: true
},
server: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/styles/',
src: ['*.css', '!DisplayResolutions.css', '!*-blessed*'],
dest: '<%= yeoman.app %>/styles/'
}]
}
},
clean: {
// Clean dist folder before creating styleguide
dist: {
files: [{
dot: true,
src: [
'<%= yeoman.dist %>/*'
]
}]
},
// Remove font files before regenerating
fonts: {
files: [{
dot: true,
src: [
'<%= yeoman.app %>/assets/fonts/icons'
]
}]
},
// Clean local server folder
server: '<%= yeoman.tmp %>'
},
concat: {
'<%= yeoman.app %>/scripts/oldie.js': [
'<%= yeoman.app %>/scripts/bower_components/html5shiv/dist/html5shiv.js',
'<%= yeoman.app %>/scripts/bower_components/matchmedia/matchMedia.js',
'<%= yeoman.app %>/scripts/bower_components/matchmedia/matchMedia.addListener.js'
],
'<%= yeoman.app %>/scripts/vendor/matchmedia-polyfills.js': [
'<%= yeoman.app %>/scripts/bower_components/matchmedia/matchMedia.js',
'<%= yeoman.app %>/scripts/bower_components/matchmedia/matchMedia.addListener.js'
],
'<%= yeoman.app %>/scripts/vendor/enquirejs-legacy.js': [
'<%= yeoman.app %>/scripts/bower_components/matchmedia/matchMedia.js',
'<%= yeoman.app %>/scripts/bower_components/matchmedia/matchMedia.addListener.js',
'<%= yeoman.app %>/scripts/bower_components/enquire/dist/enquire.min.js'
]
},
concurrent: {
server: [
'sass:serve'
],
test: [
'copy:styles'
]
},
connect: {
options: {
port: 9000,
livereload: 35729,
hostname: '127.0.0.1'
},
livereload: {
options: {
open: true,
base: [
'<%= yeoman.app %>',
'<%= yeoman.tmp %>'
]
}
},
dist: {
options: {
open: true,
base: '<%= yeoman.dist %>',
livereload: false
}
}
},
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.tmp %>',
dest: '<%= yeoman.dist %>',
src: [
'*.{ico,png,txt}',
'*.html',
'**/*.html'
]
},
{
expand: true,
dot: true,
cwd: '<%= yeoman.src %>',
dest: '<%= yeoman.dist %>',
src: [
'src/data/*.json'
]
}]
},
shims: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>/scripts/bower_components/webshim/js-webshim/minified/shims',
dest: '<%= yeoman.app %>/scripts/shims',
src: [
'{,*/}*'
]
}]
}
},
jscs: {
src: [
'<%= yeoman.app %>/scripts/components/*.js',
'!<%= yeoman.app %>/scripts/components/templates.js'
],
options: {
config: '<%= yeoman.config %>/.jscs.json'
}
},
jshint: {
options: {
jshintrc: '<%= yeoman.config %>/.jshintrc',
reporter: require('jshint-stylish'),
ignores: []
},
all: [
'Gruntfile.js',
'<%= yeoman.app %>/scripts/{,*/}*.js',
'!<%= yeoman.app %>/scripts/bower_components/*',
'!<%= yeoman.app %>/scripts/vendor/*',
'!<%= yeoman.app %>/scripts/oldie.js',
'!<%= yeoman.app %>/scripts/shims/**/*',
'!<%= yeoman.test %>/*.js',
'<%= yeoman.test %>/spec/{,*/}*.js',
'!<%= yeoman.app %>/scripts/components/templates.js'
]
},
karma: {
unit: {
configFile: '<%= yeoman.test %>/karma.conf.js',
singleRun: true
},
ci: {
configFile: '<%= yeoman.test %>/karma-ci.conf.js',
singleRun: true
},
watch: {
configFile: '<%= yeoman.test %>/karma.conf.js'
}
},
modernizr: {
devFile: '<%= yeoman.app %>/scripts/bower_components/modernizr/modernizr.js',
outputFile: '<%= yeoman.app %>/scripts/vendor/modernizr-custom.js',
files: [
'<%= yeoman.app %>/scripts/{,*/}*.js',
'<%= yeoman.app %>/styles/{,**/}*.{scss,sass}'
],
extra: {
canvas: true,
load: true,
inputtypes: true,
input: true
},
extensibility : {
addtest : true,
teststyles : true
},
uglify: true
},
prettify: {
options: {
// Task-specific options go here.
config: '<%= yeoman.config %>/.jsbeautifyrc'
},
all: {
expand: true,
cwd: '<%= yeoman.dist %>',
ext: '.html',
src: ['*.html'],
dest: '<%= yeoman.dist %>'
}
},
// grunt-contrib-sass
sass: {
serve: {
options: {
sourcemap: false,
trace: false,
unixNewlines: true,
style: 'nested',
precision: 3,
debugInfo: false,
lineNumbers: true
},
files: [{
expand: true,
cwd: '<%= yeoman.app %>/styles/scss',
src: ['main.scss', 'oldie.scss', 'styleguide.scss', 'styleguide-oldie.scss'],
dest: '<%= yeoman.app %>/styles',
ext: '.css'
}]
}
},
scsslint: {
src: ['<%= yeoman.app %>/styles/{,**/}*.{scss,sass,css}'],
options: {
config: '<%= yeoman.config %>/.scss-lint.yml',
colorizeOutput: false,
exclude: [
'<%= yeoman.app %>/styles/scss/_framework/_vendor/{,**/}*',
'<%= yeoman.app %>/styles/scss/_styleguide/_tdcss.scss',
'<%= yeoman.app %>/styles/scss/_framework/_webfonts/{,**/}*',
'<%= yeoman.app %>/styles/scss/modules/_owlcarousel.scss',
'<%= yeoman.app %>/styles/scss/modules/_royalslider.scss',
'<%= yeoman.app %>/styles/vendor/{,**/}*',
'<%= yeoman.app %>/styles/*.css'
]
}
},
inline: {
serve: {
src: [ '<%= yeoman.tmp %>/{,*/}*.html' ]
},
dist: {
src: [ '<%= yeoman.dist %>/{,*/}*.html' ]
}
},
uglify: {
options: {
mangle: false
},
scripts: {
files: {
'<%= yeoman.app %>/scripts/oldie.js': ['<%= yeoman.app %>/scripts/oldie.js'],
'<%= yeoman.app %>/scripts/vendor/matchmedia-polyfills.js': ['<%= yeoman.app %>/scripts/vendor/matchmedia-polyfills.js'],
'<%= yeoman.app %>/scripts/vendor/enquirejs-legacy.js': ['<%= yeoman.app %>/scripts/vendor/enquirejs-legacy.js']
}
}
},
watch: {
compass: {
files: ['<%= yeoman.app %>/styles/{,**/}*.{scss,sass}'],
tasks: ['sass:serve', 'bless:css', 'autoprefixer:server']
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'{<%= yeoman.tmp %>,<%= yeoman.app %>}/{,**/}*.html',
'<%= yeoman.app %>/styles/{,**/}*.css',
'<%= yeoman.app %>/scripts/{,**/}*.js',
'!{<%= yeoman.tmp %>,<%= yeoman.app %>}/scripts/bower_components/{,**/}*.js',
'!{<%= yeoman.tmp %>,<%= yeoman.app %>}/scripts/vendor/{,**/}*.js',
'<%= yeoman.app %>/assets/images/{,**/}*.{gif,jpeg,jpg,png,svg,webp}'
]
},
assemble: {
files: ['<%= yeoman.app %>/src/**/*.{md,hbs,yml}', '<%= yeoman.app %>/styleguide-src/**/*.{md,hbs,yml}'],
tasks: ['assemble', 'inline:serve']
}
},
webfont: {
dev_icons: {
src: '<%= yeoman.app %>/assets/icons/font/*.svg',
dest: '<%= yeoman.app %>/assets/fonts/icons',
destCss: '<%= yeoman.app %>/styles/scss/base',
options: {
template: '<%= yeoman.app %>/styles/scss/_framework/_webfonts/sass.css',
htmlDemo: false,
hashes: false,
stylesheet: 'scss',
relativeFontPath: '../assets/fonts/icons/',
syntax: 'bootstrap',
templateOptions: {
baseClass: 'devcon',
classPrefix: 'icon',
mixinPrefix: 'devcon'
}
}
}
},
// configurable paths
yeoman: {
app: '../',
dist: 'pages',
test: '../scripts/test',
config: '../.config',
tmp: '.tmp',
src: './'
}
});
/**
* Post-install scripts
* ------------------------------------------------------------
*/
grunt.registerTask('post-install', [
'modernizr',
'clean:hooks',
'githooks'
]);
/**
* Run styleguide locally
* ------------------------------------------------------------
*/
grunt.registerTask('serve', function (target) {
if (target === 'dist') {
return grunt.task.run(['build', 'connect:dist:keepalive']);
}
// load local serve config if exist
if (grunt.file.exists('serve-config.json')) {
var localServeConfig = grunt.file.readJSON('serve-config.json');
// merge local options to default init configuration
grunt.config.merge(localServeConfig);
}
grunt.task.run([
'clean:server',
'assemble',
'run-sass',
'inline:serve',
'connect:livereload',
'watch'
]);
});
/**
* Build HTML-pages from handlebars and update the styleguide
* ------------------------------------------------------------
*/
grunt.registerTask('build-prototypes', [
'karma:unit',
'build'
]);
grunt.registerTask('build', [
'clean:dist',
'assemble',
'concat',
'uglify:scripts',
'copy:dist',
'run-sass',
'prettify:all',
'modernizr',
'inline:dist'
]);
/**
* NEW.
* ------------------------------------------------------------
*/
grunt.registerTask('update-shims', [
'copy:shims'
]);
/**
* Utility tasks to generate icon fonts and image versions.
* ------------------------------------------------------------
*/
grunt.registerTask('generate-icons', [
'clean:fonts',
'webfont:dev_icons'
]);
grunt.registerTask('run-sass', [
'sass:serve',
'autoprefixer:server',
'bless:css'
]);
/**
* Different test tasks
* ------------------------------------------------------------
*/
grunt.registerTask('test', [
'karma:watch',
'jscs',
'jshint',
'scsslint'
]);
grunt.registerTask('test-js', [
'jshint',
'karma:ci',
'jscs'
]);
grunt.registerTask('test-ci', [
'scsslint',
'test-js'
]);
grunt.registerTask('default', [
'jscs',
'jshint',
'scsslint',
'build'
]);
};
{
"name": "telenor",
"description": "Telenor website",
"version": "0.6.0",
"repository": {
"type": "git",
"url": "https://github.com/designit/telenor.git"
},
"bugs": {
"url": "https://github.com/designit/telenor/issues"
},
"dependencies": {},
"devDependencies": {
"assemble": "~0.4.35",
"assemble-yaml": "^0.2.1",
"chai": "^1.9.1",
"globule": "^0.2.0",
"grunt": "~0.4.1",
"grunt-autoprefixer": "^1.0.0",
"grunt-bless": "^0.1.1",
"grunt-bower-install": "^0.5.2",
"grunt-build-control": "~0.1.2",
"grunt-concurrent": "^0.3.1",
"grunt-contrib-clean": "^0.5.0",
"grunt-contrib-concat": "^0.3.0",
"grunt-contrib-connect": "^0.7.1",
"grunt-contrib-copy": "^0.4.1",
"grunt-contrib-cssmin": "^0.6.2",
"grunt-contrib-handlebars": "^0.7.0",
"grunt-contrib-htmlmin": "^0.1.3",
"grunt-contrib-imagemin": "^0.2.1",
"grunt-contrib-jshint": "^0.6.5",
"grunt-contrib-sass": "^0.7.4",
"grunt-contrib-uglify": "^0.6.0",
"grunt-contrib-watch": "^0.5.3",
"grunt-embed": "^0.1.2",
"grunt-exec": "^0.4.6",
"grunt-githooks": "^0.3.1",
"grunt-htmlhint": "^0.4.0",
"grunt-inline": "^0.3.2",
"grunt-jscs-checker": "^0.4.4",
"grunt-karma": "^0.8.2",
"grunt-mkdir": "~0.1.1",
"grunt-mocha": "~0.4.0",
"grunt-modernizr": "^0.4.1",
"grunt-prettify": "^0.3.4",
"grunt-requirejs": "^0.4.0",
"grunt-responsive-images": "~0.1.1",
"grunt-rev": "~0.1.0",
"grunt-scss-lint": "^0.3.3",
"grunt-svgmin": "^0.2.1",
"grunt-usemin": "^2.0.2",
"grunt-webfont": "^0.2.2",
"jshint-stylish": "^0.1.5",
"karma": "^0.12.22",
"karma-browserstack-launcher": "0.0.8",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^0.1.3",
"karma-firefox-launcher": "^0.1.3",
"karma-mocha": "^0.1.8",
"karma-opera-launcher": "^0.1.0",
"karma-phantomjs-launcher": "^0.1.4",
"karma-requirejs": "^0.2.2",
"karma-safari-launcher": "^0.1.1",
"karma-sinon": "^1.0.3",
"load-grunt-tasks": "^0.1.3",
"lodash": "^2.4.1",
"marked": "^0.3.2",
"mocha": "^1.21.4",
"requirejs": "^2.1.11",
"sinon": "^1.9.1",
"time-grunt": "^0.1.2"
},
"engines": {
"node": ">=0.8.0"
},
"scripts": {
"test": "grunt test-ci",
"postinstall": "grunt post-install"
}
}
# Steps
## Remove submodules
- git submodule deinit OneScreen/styles
- git rm OneScreen/styles
- [commit changes]
- git submodule deinit OneScreen/assets
- git rm OneScreen/assets
- [commit changes]
- git submodule deinit OneScreen/javascript-tests
- git rm OneScreen/javascript-tests
- [commit changes]
- git submodule deinit OneScreen/.config
- git rm OneScreen/.config
- [commit changes]
## Config
- mkdir OneScreen/.config
- [Copy ** from osef-config@github to OneScreen/.config]
- rm -rf OneScreen/.config/.git*
- [Commit changes]
## Add prototypes
- mkdir OneScreen/prototypes
- mkdir OneScreen/prototypes/pages
- [Copy app/src and app/styleguide-src from telenor@github to OneScreen/prototypes]
- rm -rf OneScreen/prototypes/src/_framework
- [Add Gruntfile.js and package.json from this pack to OneScreen/prototypes]
- [Commit changes]
- git submodule add <url> OneScreen/prototypes/src/_framework
- git submodule update --init
- [commit changes]
## Add styles
- mkdir OneScreen/styles
- [Copy ** from telenor-styles@github to OneScreen/styles]
- rm -rf OneScreen/styles/.git*
- [Edit Gruntfile.js]
- [add .bat-file]
- [Commit changes]
- git submodule add <url> OneScreen/styles/scss/_framework
- git submodule update --init
- [checkout master branch on scss/_framework]
- [commit changes]
## Add assets
- [Copy ** from telenor-assets@github to stash OneScreen/assets]
- rm -rf OneScreen/assets/.git*
- rm -rf OneScreen/assets/_framework
- [commit changes]
- git submodule add <url> OneScreen/assets/_framework
- git submodule update --init
- [commit changes]
## Install npm modules
- npm install (in OneScreen/prototypes)
- npm install (in OneScreen/styles)
- Check they are properly ignored
- Check grunt tasks work
- Push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.