Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

Commit

Permalink
feat(grunt): use Angular UI publisher
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasduteil committed Jan 1, 2014
1 parent a9e641d commit d18a7d1
Show file tree
Hide file tree
Showing 6 changed files with 210 additions and 41 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
bower_components
dist
out
43 changes: 12 additions & 31 deletions demo/demo.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,24 @@
/**
Demo CSS
*************************************/
.jumbotron{
margin-bottom: 0;
background-color: #009fd6;;
.layout-mock *:not(.ui-splitbar){
background : #eee no-repeat center;
}
.jumbotron h1{
font-size: 50px;
line-height: 1;
color: #fff;
}
h1, em {color: #009fd6;}

.aSpace{
background: #e6f1fa;
}

.show-grid {
margin-bottom: 15px;
.layout-mock .center-back{
background-image: url("http://placehold.it/400x300/eee/666&text=CENTER");
}
.show-grid [class^="col-"] {
padding-top: 10px;
padding-bottom: 10px;
background-color: #eee;
border: 1px solid #ddd;
background-color: rgba(86,61,124,.15);
border: 1px solid rgba(86,61,124,.2);
.layout-mock .north-back{
background-image: url("http://placehold.it/400x300/eee/666&text=NORTH");
}

.html-back{
background : #eee url("http://placehold.it/400x300/eee/666&text=HTML") no-repeat center;

.layout-mock .south-back{
background-image: url("http://placehold.it/400x300/eee/666&text=SOUTH");
}
.css-back{
background : #eee url("http://placehold.it/400x300/eee/666&text=CSS") no-repeat center;

.layout-mock .east-back{
background-image: url("http://placehold.it/400x300/eee/666&text=EAST");
}
.js-back{
background : #eee url("http://placehold.it/400x300/eee/666&text=JS") no-repeat center;

.layout-mock .west-back{
background-image: url("http://placehold.it/400x300/eee/666&text=WEST");
}

134 changes: 134 additions & 0 deletions demo/demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
<section id="layout" ng-app="doc.ui-layout">

<!-- =Minimal code
--------------------------------------------------------------------------- -->
<div id="demo-mini">
<div class="page-header">
<h1>Minimal code</h1>
</div>
<div class="row">
<div class="col-md-6">
<div style="position: relative; height: 220px;">
<div ui-layout class="layout-mock">
<div class="center-back"></div>
</div>
</div>
</div>

<div class="col-md-6" ng-controller="PlunkerCtrl"
ng-init="
vendor_css=['https://rawgithub.com/angular-ui/ui-layout/master/src/ui-layout.css'];
vendor_js=['https://rawgithub.com/angular-ui/ui-layout/master/src/ui-layout.js'];
"
>
<div class="pull-right">
<button class="btn btn-info" ng-click="edit('1.2.6', 'UI.Layout', 'ui-layout')">
<i class="glyphicon glyphicon-edit"></i> Edit in plunker
</button>
</div>

<tabset>
<tab heading="Markup">
<div plunker-content="markup">
<pre class="prettyprint">&lt;div ui-layout class=&quot;layout-mock&quot;&gt;
&lt;div class=&quot;center-back&quot;&gt;&lt;/div&gt;
&lt;/div&gt;</pre>
</div>
</tab>
<tab heading="CSS">
<div plunker-content="css">
<pre class="prettyprint">.layout-mock *:not(.ui-splitbar){
background : #eee no-repeat center;
}

.layout-mock .center-back{
background-image: url("http://placehold.it/400x300/eee/666&text=CENTER");
}</pre>
</div>
</tab>
</tabset>
</div>
</div>
</div>



<!-- =Holy grail
--------------------------------------------------------------------------- -->
<div id="demo-mini">
<div class="page-header">
<h1>Holy grail demo</h1>
</div>

<div style="position: relative; height: 500px;">

<div ui-layout class="layout-mock">
<header class="north-back"></header>
<ui-layout options="{ flow : 'column' }">
<sidebar class="east-back"></sidebar>
<div class="center-back"></div>
<sidebar class="west-back"></sidebar>
</ui-layout>
<footer class="south-back"></footer>
</div>

</div>

<hr>

<div ng-controller="PlunkerCtrl"
ng-init="
vendor_css=['https://rawgithub.com/angular-ui/ui-layout/master/src/ui-layout.css'];
vendor_js=['https://rawgithub.com/angular-ui/ui-layout/master/src/ui-layout.js'];
"
>
<div class="pull-right">
<button class="btn btn-info" ng-click="edit('1.2.6', 'UI.Layout', 'ui-layout')">
<i class="glyphicon glyphicon-edit"></i> Edit in plunker
</button>
</div>

<tabset>
<tab heading="Markup">
<div plunker-content="markup">
<pre class="prettyprint">&lt;div ui-layout class=&quot;layout-mock&quot;&gt;
&lt;header class=&quot;north-back&quot;&gt;&lt;/header&gt;
&lt;ui-layout options=&quot;{ flow : &#39;column&#39; }&quot;&gt;
&lt;sidebar class=&quot;east-back&quot;&gt;&lt;/sidebar&gt;
&lt;div class=&quot;center-back&quot;&gt;&lt;/div&gt;
&lt;sidebar class=&quot;west-back&quot;&gt;&lt;/sidebar&gt;
&lt;/ui-layout&gt;
&lt;footer class=&quot;south-back&quot;&gt;&lt;/footer&gt;
&lt;/div&gt;</pre>
</div>
</tab>
<tab heading="CSS">
<div plunker-content="css">
<pre class="prettyprint">.layout-mock *:not(.ui-splitbar){
background : #eee no-repeat center;
}


.layout-mock .center-back{
background-image: url("http://placehold.it/400x300/eee/666&text=CENTER");
}
.layout-mock .north-back{
background-image: url("http://placehold.it/400x300/eee/666&text=NORTH");
}
.layout-mock .south-back{
background-image: url("http://placehold.it/400x300/eee/666&text=SOUTH");
}
.layout-mock .east-back{
background-image: url("http://placehold.it/400x300/eee/666&text=EAST");
}
.layout-mock .west-back{
background-image: url("http://placehold.it/400x300/eee/666&text=WEST");
}
</pre>
</div>
</tab>
</tabset>
</div>
</div>

</section>
52 changes: 43 additions & 9 deletions gruntFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,46 @@ module.exports = function (grunt) {

// Task.
grunt.registerTask('default', ['jshint', 'karma:unit']);
grunt.registerTask('serve', ['connect:continuous', 'karma:continuous', 'watch']);
grunt.registerTask('dist', ['ngmin', 'uglify']);
grunt.registerTask('serve', ['karma:continuous', 'dist', 'connect:continuous', 'build:gh-pages', 'watch']);
grunt.registerTask('dist', ['ngmin', 'copy', 'uglify']);

grunt.registerTask('karma:continuous', ['karma:wjqlite_bg', 'karma:wjquery_bg']);
grunt.registerTask('karma:unit', ['karma:wjqlite:unit', 'karma:wjquery:unit']);
grunt.registerTask('karma:unit:run', ['karma:wjqlite:unit:run', 'karma:wjquery:unit:run']);


// HACK TO ACCESS TO THE COMPONENT-PUBLISHER
function fakeTargetTask(prefix){
return function(){

if (this.args.length !== 1) return grunt.log.fail('Just give the name of the ' + prefix + ' you want like :\ngrunt ' + prefix + ':bower');

var done = this.async();
var spawn = require('child_process').spawn;
spawn('./node_modules/.bin/gulp', [ prefix, '--branch='+this.args[0] ].concat(grunt.option.flags()), {
cwd : './node_modules/angular-ui-publisher',
stdio: 'inherit'
}).on('close', done);
};
}

grunt.registerTask('build', fakeTargetTask('build'));
grunt.registerTask('publish', fakeTargetTask('publish'));
//


// HACK TO MAKE TRAVIS WORK
var testConfig = function (configFile, customOptions) {
var options = { configFile: configFile, singleRun: true };
var travisOptions = process.env.TRAVIS && { browsers: [ 'Firefox', 'PhantomJS'], reporters: ['dots'] };
return grunt.util._.extend(options, customOptions, travisOptions);
};
//


// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
mainFileName: 'ui-layout',
meta: {
banner: ['/**',
' * <%= pkg.name %> - <%= pkg.description %>',
Expand All @@ -35,9 +58,8 @@ module.exports = function (grunt) {

connect: {
options: {
port: grunt.option('port') || '8000',
hostname: grunt.option('host') || 'localhost',
open: 'http://<%= connect.options.hostname %>:<%= connect.options.port %>/demo',
base : 'out/built/gh-pages',
open: true,
livereload: true
},
server: { options: { keepalive: true } },
Expand All @@ -58,15 +80,19 @@ module.exports = function (grunt) {
// =======
watch: {
src: {
files: ['src/*', 'demo/**/*.js'],
tasks: ['jshint:src', 'karma:unit:run', 'dist']
files: ['src/*'],
tasks: ['jshint:src', 'karma:unit:run', 'dist', 'build:gh-pages']
},
test: {
files: ['test/*.spec.js'],
tasks: ['jshint:test', 'karma:unit:run']
},
demo: {
files: ['demo/*', 'src/*'],
files: ['demo/**', 'publish.js'],
tasks: ['build:gh-pages']
},
livereload: {
files: ['out/built/gh-pages/**/*'],
options: { livereload: true }
}
},
Expand Down Expand Up @@ -128,6 +154,14 @@ module.exports = function (grunt) {
}
},

copy: {
main: {
files: [
{src: ['src/ui-layout.css'], dest: 'dist/ui-layout.css', filter: 'isFile'}
]
}
},

// CHANGELOG
// =========
changelog: {
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"grunt-karma": "~0.6.2",
"grunt-contrib-connect": "~0.6.0",
"grunt-contrib-uglify": "~0.2.7",
"grunt-conventional-changelog": "~1.0.0"
"grunt-conventional-changelog": "~1.0.0",
"angular-ui-publisher": "~1.2.2",
"grunt-contrib-copy": "~0.5.0"
},
"main": "ui-layout.js",
"repository": {
Expand Down
17 changes: 17 additions & 0 deletions publish.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* jshint node:true */

'use strict';

var fs = require('fs');

module.exports = function() {

return {
humaName : 'UI.Layout',
repoName : 'ui-layout',
inlineHTML : fs.readFileSync(__dirname + '/demo/demo.html'),
inlineJS : 'angular.module(\'doc.ui-layout\', [\'ui.layout\', \'prettifyDirective\', \'ui.bootstrap\', \'plunker\' ]);',
css : ['demo/demo.css', 'dist/ui-layout.css'],
js : ['dist/ui-layout.js']
};
};

0 comments on commit d18a7d1

Please sign in to comment.