Skip to content
This repository was archived by the owner on May 25, 2019. It is now read-only.

Commit 5efbfca

Browse files
committed
Merge pull request #8 from douglasduteil/refacto-more-grunt
Refacto more grunt
2 parents a18c9a4 + 3d2da2b commit 5efbfca

File tree

6 files changed

+147
-314
lines changed

6 files changed

+147
-314
lines changed

.tmpl/index.tmpl

+108-104
Original file line numberDiff line numberDiff line change
@@ -6,118 +6,122 @@
66
<title>Angular UI ~ <%= meta.view.humaName %> Doc</title>
77

88
<!-- Le css -->
9-
<link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
10-
<link rel="stylesheet" href="assets/css/style.css">
11-
<link rel="stylesheet" href="assets/css/cssLoading.css">
12-
<link rel="stylesheet" href="assets/css/prettify.css">
9+
<link rel="stylesheet" type="text/css" href="assets/css/bootstrap.min.css"/>
10+
<link rel="stylesheet" type="text/css" href="assets/css/style.css"/>
11+
<link rel="stylesheet" type="text/css" href="assets/css/prettify.css"/>
12+
13+
<%
14+
var cssFiles = grunt.config('meta.view.css') || [];;
15+
16+
for(var i = 0, len = cssFiles.length; i < len; i++) {
17+
print(' <link rel="stylesheet" type="text/css" href="' + cssFiles[i] + '"/>\n');
18+
}
19+
%>
1320

1421
</head>
1522

1623
<body>
1724

18-
<!-- Le navbar
19-
================================================== -->
20-
<div class="navbar navbar-fixed-top">
21-
<div class="navbar-inner">
22-
<div class="container">
23-
<div class="dropdown pull-left">
24-
<a class="brand dropdown-toggle" role="button" data-toggle="dropdown" href="#">
25-
<%= meta.view.humaName %>
26-
<b class="caret"></b>
27-
</a>
28-
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
29-
<li><a href="https://github.com/angular-ui/"><strong>Related Projects:</strong></a></li>
30-
<li class="divider"></li>
31-
<li><a href="http://angular-ui.github.io/">AngularUI</a></li>
32-
<li><a href="http://angular-ui.github.io/bootstrap/">UI Bootstrap</a></li>
33-
<li><a href="http://angular-ui.github.io/ng-grid/">Grid</a></li>
34-
<li><a href="https://github.com/angular-ui/AngularJs.tmbundle">AngularJS.tmbundle</a></li>
35-
<li><a href="http://angular-ui.github.io/ui-router/sample/">Router <span class="label label-success">New!</span></a></li>
36-
</ul>
37-
</div>
38-
<div class="nav-collapse pull-right">
39-
<ul class="nav">
40-
<li class="dropdown" ng-show="!isLoading" style="display: none">
41-
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Modules <b class="caret"></b></a>
42-
<ul class="dropdown-menu">
43-
<li ng-repeat="s in sections"><a href="#{{s.id}}"> {{s.name}} </a></li>
44-
</ul>
45-
</li>
46-
47-
</ul>
48-
</div>
49-
</div>
50-
</div>
51-
</div>
52-
<div style="margin: 32px;"></div>
53-
54-
<!-- Le header
55-
================================================== -->
56-
<header class="hero-unit" id="overview">
57-
<div class="container">
58-
59-
<h1><%= meta.view.humaName %></h1>
60-
61-
<p><%= pkg.description %></p>
62-
63-
<p class="btn-group">
64-
<a class="btn" href="https://github.com/angular-ui/<%= meta.view.repoName %>"><i class="icon-github"></i> Code on Github</a>
65-
<a class="btn btn-primary" href="https://github.com/angular-ui/<%= meta.view.repoName %>/tree/gh-pages/build">
66-
<i class="icon-download-alt icon-white"></i> Download <small>(<%= pkg.version %>)</small>
67-
</a>
68-
</p>
69-
</div>
70-
<div class="bs-docs-social">
71-
<div class="container">
72-
<ul class="bs-docs-social-buttons">
73-
<li>
74-
<iframe src="http://ghbtns.com/github-btn.html?user=angular-ui&amp;repo=<%= meta.view.repoName %>&amp;type=watch&amp;count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110" height="20"></iframe>
75-
</li>
76-
<li>
77-
<iframe src="http://ghbtns.com/github-btn.html?user=angular-ui&amp;repo=<%= meta.view.repoName %>&amp;type=fork&amp;count=true" allowtransparency="true" frameborder="0" scrolling="0" width="95" height="20"></iframe>
78-
</li>
79-
<li>
80-
<!-- Place this tag where you want the +1 button to render. -->
81-
<div class="g-plusone" data-size="medium"></div>
82-
83-
<!-- Place this tag after the last +1 button tag. -->
84-
<script type="text/javascript">
85-
(function () {
86-
var po = document.createElement('script');
87-
po.type = 'text/javascript';
88-
po.async = true;
89-
po.src = 'https://apis.google.com/js/plusone.js';
90-
var s = document.getElementsByTagName('script')[0];
91-
s.parentNode.insertBefore(po, s);
92-
})();
93-
</script>
94-
</li>
95-
</ul>
96-
</div>
97-
</div>
98-
</header>
99-
100-
<!-- Le main
101-
================================================== -->
102-
<div class="container main ng-cloak" ng-controller="MainCtrl" ng-cloak>
103-
<div ng-include src="'demos.html'" onload="makeNav()"></div>
104-
</div>
105-
106-
<!-- Le loading
107-
================================================== -->
108-
109-
<div class="loadingAnimation" ng-show="isLoading">
110-
<div class="bowl_ringG">
111-
<div class="ball_holderG">
112-
<div class="ballG">
25+
<!-- Le navbar
26+
================================================== -->
27+
<div class="navbar navbar-fixed-top">
28+
<div class="navbar-inner">
29+
<div class="container">
30+
<div class="dropdown pull-left">
31+
<a class="brand dropdown-toggle" role="button" data-toggle="dropdown" href="#">
32+
<%= meta.view.humaName %>
33+
<b class="caret"></b>
34+
</a>
35+
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
36+
<li><a href="https://github.com/angular-ui/"><strong>Related Projects:</strong></a></li>
37+
<li class="divider"></li>
38+
<li><a href="http://angular-ui.github.io/">AngularUI</a></li>
39+
<li><a href="http://angular-ui.github.io/bootstrap/">UI Bootstrap</a></li>
40+
<li><a href="http://angular-ui.github.io/ng-grid/">Grid</a></li>
41+
<li><a href="https://github.com/angular-ui/AngularJs.tmbundle">AngularJS.tmbundle</a></li>
42+
<li><a href="http://angular-ui.github.io/ui-router/sample/">Router <span class="label label-success">New!</span></a></li>
43+
</ul>
44+
</div>
45+
</div>
11346
</div>
114-
</div>
11547
</div>
116-
</div>
48+
<div style="margin: 32px;"></div>
49+
50+
<!-- Le header
51+
================================================== -->
52+
<header class="hero-unit" id="overview">
53+
<div class="container">
54+
55+
<h1><%= meta.view.humaName %></h1>
56+
57+
<p><%= pkg.description %></p>
58+
59+
<p class="btn-group">
60+
<a class="btn" href="https://github.com/angular-ui/<%= meta.view.repoName %>"><i class="icon-github"></i> Code on Github</a>
61+
<a class="btn btn-primary" href="https://github.com/angular-ui/<%= meta.view.repoName %>/tree/gh-pages/build">
62+
<i class="icon-download-alt icon-white"></i> Download <small>(<%= pkg.version %>)</small>
63+
</a>
64+
</p>
65+
</div>
66+
<div class="bs-docs-social">
67+
<div class="container">
68+
<ul class="bs-docs-social-buttons">
69+
<li>
70+
<iframe src="http://ghbtns.com/github-btn.html?user=angular-ui&amp;repo=<%= meta.view.repoName %>&amp;type=watch&amp;count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110" height="20"></iframe>
71+
</li>
72+
<li>
73+
<iframe src="http://ghbtns.com/github-btn.html?user=angular-ui&amp;repo=<%= meta.view.repoName %>&amp;type=fork&amp;count=true" allowtransparency="true" frameborder="0" scrolling="0" width="95" height="20"></iframe>
74+
</li>
75+
<li>
76+
<!-- Place this tag where you want the +1 button to render. -->
77+
<div class="g-plusone" data-size="medium"></div>
78+
79+
<!-- Place this tag after the last +1 button tag. -->
80+
<script type="text/javascript">
81+
(function () {
82+
var po = document.createElement('script');
83+
po.type = 'text/javascript';
84+
po.async = true;
85+
po.src = 'https://apis.google.com/js/plusone.js';
86+
var s = document.getElementsByTagName('script')[0];
87+
s.parentNode.insertBefore(po, s);
88+
})();
89+
</script>
90+
</li>
91+
</ul>
92+
</div>
93+
</div>
94+
</header>
95+
96+
<!-- Le main
97+
================================================== -->
98+
<div class="container">
99+
100+
<%= meta.view.demoHTML %>
101+
102+
</div>
103+
104+
<!-- Le javascript
105+
================================================== -->
106+
107+
<script src="assets/vendor/jquery.min.js"></script>
108+
<script src="assets/vendor/bootstrap.min.js"></script>
109+
110+
<script src="assets/vendor/prettify.js"></script>
111+
112+
<script src="assets/vendor/angular.min.js"></script>
113+
<script src="core/prettifyDirective.js"></script>
114+
115+
<%
116+
var jsFiles = grunt.config('meta.view.js') || [];
117117

118-
<!-- Le javascript
119-
================================================== -->
120-
<script data-main="core/main.js" src="assets/vendor/require.min.js"></script>
118+
for(var i = 0, len = jsFiles.length; i < len; i++) {
119+
print(' <script src="' + jsFiles[i] + '"></script>\n');
120+
}
121+
%>
122+
<script>
123+
<%= meta.view.demoJS %>
124+
</script>
121125

122126
</body>
123127

.travis/after_success.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ echo -e "\n>>> Current Repo:$REPO --- Travis Branch:$TRAVIS_BRANCH\n"
77

88
echo -e ">>> Grunt the doc.\n"
99
grunt build-doc
10-
cp -R components/angular-ui-docs $HOME/out
10+
cp -R bower_components/angular-ui-docs $HOME/out
1111

1212

1313
echo -e ">>> Clone the gh-pages branch.\n"

.travis/before_script.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ base64 --decode --ignore-garbage ~/.ssh/travis_rsa_64 > ~/.ssh/id_rsa
1818
chmod 600 ~/.ssh/id_rsa
1919

2020
echo -e ">>> Copy config"
21-
mv -fv components/angular-ui-docs/.travis/ssh-config ~/.ssh/config
21+
mv -fv bower_components/angular-ui-docs/.travis/ssh-config ~/.ssh/config
2222

2323
echo -e ">>> Hi github.com !"
2424

README.md

+37-22
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@ This generator use Grunt, AngularJS, RequireJS and jQuery.
55

66
## How to add it !
77

8-
Add it as a submodule of your module.
8+
Add it as a bower component.
99

1010
```sh
11-
git submodule add git://github.com/angular-ui/angular-ui-docs.git out
11+
bower install git://github.com/angular-ui/angular-ui-docs.git
12+
```
13+
or add to your `bower.json`
14+
```Javascript
15+
"devDependencies": {
16+
"angular-ui-docs": "angular-ui/angular-ui-docs"
17+
}
1218
```
1319

1420
**It's working with ssh deploy key !**
@@ -25,7 +31,7 @@ env:
2531

2632
Then add the scripts and limit the build-able branches.
2733

28-
```
34+
```yaml
2935
before_script: out/.travis/before_script.sh
3036
after_success: out/.travis/after_success.sh
3137
branches:
@@ -45,10 +51,18 @@ First you need to generate the `index.html` using [grunt-contrib-copy](https://g
4551
grunt.initConfig({
4652
pkg: grunt.file.readJSON('package.json'),
4753
meta: {
48-
view : {
49-
humaName : "UI <repo>",
50-
repoName : "<the github repo name>"
51-
}
54+
view : {
55+
humaName : "UI <repo>",
56+
repoName : "<the github repo name>",
57+
demoHTML : grunt.file.read("demo/demo.html"),
58+
demoJS : grunt.file.read("demo/demo.js"),
59+
css : [
60+
'<any required css files>'
61+
],
62+
js : [
63+
'<any required script files>'
64+
]
65+
}
5266
},
5367
copy: {
5468
template : {
@@ -67,22 +81,23 @@ This will generate `index.html` using :
6781
- the `meta.view.humaName` as title of the demo site,
6882
- the `meta.view.repoName` in the github links,
6983

70-
Then, like `index.html` automatically include a `demo.html` file, you will have to copy yours.
7184

72-
```Javascript
73-
grunt.initConfig({
74-
copy: {
75-
main: {
76-
files: [
77-
{src: ['demo/demo.html'], dest: 'out/demos.html', filter: 'isFile'}
78-
]
79-
}
80-
}
81-
});
82-
```
85+
## See it working locally !
86+
Actually the demo must be built !
87+
We are using _bower_ and _grunt_ for this.
8388

84-
In this file you can use RequireJS, AngularJS and jQuery.
85-
I added a `requireCSS` as a HACK 'cause it's home made...
89+
First in you UI project run
90+
```sh
91+
npm install && bower install
92+
grunt build-doc
93+
```
8694

87-
In bonus, the id of each section tag in the page are drawn into a _Module_ menu at the top right of the page.
95+
Then run a localhost on `bower_components/angular-ui-docs`
96+
```sh
97+
cd bower_components/angular-ui-docs
98+
python -m SimpleHTTPServer
99+
or
100+
php -S localhost:8000
101+
```
88102

103+
and you'll have the generated website on http://localhost:8000/

0 commit comments

Comments
 (0)