Skip to content
This repository was archived by the owner on Apr 30, 2018. It is now read-only.

Commit bd5a290

Browse files
committed
Added some Grunt sugar: Now 'grunt dev' watches the files in /src and magiliciously reloads the page.
1 parent 42c37f0 commit bd5a290

File tree

5 files changed

+33
-11
lines changed

5 files changed

+33
-11
lines changed

Gruntfile.js

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,25 @@ module.exports = function(grunt) {
44
// Project configuration.
55
grunt.initConfig({
66
pkg: grunt.file.readJSON('package.json'),
7+
formlyConfig: {
8+
hostname: '*',
9+
base: 'src',
10+
port: 4000,
11+
livereloadport: 35701,
12+
},
713
connect: {
814
dev: {
915
options: {
10-
port: 4000,
11-
base: 'src',
12-
keepalive: true
16+
hostname: '<%= formlyConfig.hostname %>',
17+
port: '<%= formlyConfig.port %>',
18+
base: '<%= formlyConfig.base %>',
19+
livereload: '<%= formlyConfig.livereloadport %>',
1320
},
1421
}
1522
},
1623
'gh-pages': {
1724
options: {
18-
base: 'src'
25+
base: '<%= formlyConfig.base %>'
1926
},
2027
src: ['**']
2128
},
@@ -27,7 +34,7 @@ module.exports = function(grunt) {
2734
files: [
2835
{
2936
expand: true,
30-
cwd: 'src/',
37+
cwd: '<%= formlyConfig.base %>/',
3138
src: ['directives/formly*.*', 'modules/formly*.*', '!.jshintrc'],
3239
dest: '.tmp/'
3340
}
@@ -86,7 +93,16 @@ module.exports = function(grunt) {
8693
src: '.tmp/formly.js',
8794
dest: '.tmp/formly.js'
8895
}
96+
},
97+
watch: {
98+
livereload: {
99+
files: ['<%= formlyConfig.base %>/**/*.{js,html}'],
100+
options: {
101+
livereload: '<%= formlyConfig.livereloadport %>'
102+
},
103+
}
89104
}
105+
90106
});
91107

92108
// Load the plugin that provides the "uglify" task.
@@ -98,13 +114,15 @@ module.exports = function(grunt) {
98114
grunt.loadNpmTasks('grunt-gh-pages');
99115
grunt.loadNpmTasks('grunt-angular-templates');
100116
grunt.loadNpmTasks('grunt-ngmin');
117+
grunt.loadNpmTasks('grunt-contrib-watch');
101118

102119
grunt.registerTask('publish', [
103120
'gh-pages'
104121
]);
105122

106123
grunt.registerTask('dev', [
107-
'connect:dev'
124+
'connect:dev',
125+
'watch'
108126
]);
109127

110128
grunt.registerTask('build', [

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
],
2727
"dependencies": {
2828
"angular": "~1.2.10",
29-
"bootstrap": "~3.1.0"
29+
"bootstrap": "~3.1.1"
3030
},
3131
"devDependencies": {
3232
"angular-ui-router": "#0.2.8-bowratic-tedium",

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
"grunt-ngmin": "0.0.3",
1515
"grunt-contrib-copy": "~0.5.0",
1616
"grunt-contrib-clean": "~0.5.0",
17-
"grunt-contrib-uglify": "~0.3.2"
17+
"grunt-contrib-uglify": "~0.3.2",
18+
"grunt-contrib-watch": "~0.6.1",
19+
"connect-livereload": "~0.4.0"
1820
}
1921
}

src/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
<div class="footer">
2525
<div class="container">
2626
Created by <a href="http://gonimbly.com">Nimbly</a><br>
27-
We're hiring, come help us build amazing applications!
27+
We're hiring, come help us build amazing applications!<br>
28+
<a href="https://github.com/nimbly/angular-formly">GitHub</a>
2829
</div>
2930
</div>
3031

src/views/home.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<div class="jumbotron">
22
<div class="container">
33
<h1>Formly for Angular</h1>
4-
<p>JSON powered forms</p>
4+
<p>JSON powered forms <br>
5+
<a href="https://github.com/nimbly/angular-formly">https://github.com/nimbly/angular-formly</a></p>
56
</div>
67
</div>
7-
<div class="container">
8+
<div class="container-fluid">
89
<div class="row">
910
<div class="col-sm-4 col-md-4 col-lg-4"
1011
ng-hide="editJSON">

0 commit comments

Comments
 (0)