Skip to content

Commit 97ba9d4

Browse files
grunt serve added, fixed grunt watch
1 parent 1dbd128 commit 97ba9d4

File tree

3 files changed

+99
-92
lines changed

3 files changed

+99
-92
lines changed

Gruntfile.js

Lines changed: 80 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,81 @@
1-
module.exports = function (grunt) {
2-
var config = {};
3-
4-
5-
//src ===============================
6-
var src;
7-
config.src = src = {
8-
sassMain : 'scss/main.scss',
9-
distFolder : 'examples/css/app.dist.css',
10-
devFolder : 'examples/css/app.dev.css',
11-
sassFolder : 'scss/**/*.scss',
12-
13-
};
14-
15-
16-
//Watch ===============================
17-
config.watch = {
18-
scripts: {
19-
files: ["<%= src.libFolder %>", "<%= src.sassFolder %>"]
20-
,tasks: ["dev", "sass:dist"]
21-
//,tasks: ["dev",'sass:dist']
22-
}
23-
}
24-
25-
26-
//Sass ===============================
27-
var sass;
28-
config.sass = sass = {};
29-
30-
//distribution
31-
sass.dist = {
32-
options: {
33-
style: "compressed",
34-
noCache: true,
35-
sourcemap: 'none',
36-
update:true
37-
}
38-
, files: {
39-
"<%= src.distFolder %>" : "<%= src.sassMain %>"
40-
}
41-
};
42-
43-
//development env.
44-
sass.dev = {
45-
options: {
46-
style: "expanded",
47-
lineNumber: true,
48-
}
49-
, files: {
50-
"<%= src.devFolder %>" : "<%= src.sassMain %>"
51-
}
52-
};
53-
54-
55-
56-
//Register custom tasks ===============================
57-
grunt.registerTask('default',['dev']);
58-
grunt.registerTask('dev', ['sass:dev']);
59-
grunt.registerTask('dist',['sass:dist']);
60-
require('time-grunt')(grunt);
61-
require('load-grunt-tasks')(grunt, {
62-
scope: 'devDependencies'
63-
});
64-
65-
66-
//General setup ===============================
67-
grunt.initConfig(config);
68-
69-
};
1+
module.exports = function(grunt) {
2+
var config = {};
703

4+
5+
//src ===============================
6+
var src;
7+
config.src = src = {
8+
sassMain: 'scss/main.scss',
9+
distFolder: 'examples/css/app.dist.css',
10+
devFolder: 'examples/css/app.dev.css',
11+
sassFolder: 'scss/**/*.scss',
12+
serverPort: 8000
13+
14+
};
15+
16+
17+
//Watch ===============================
18+
config.watch = {
19+
scripts: {
20+
files: ["<%= src.sassFolder %>"],
21+
tasks: ["dev", "sass:dist"]
22+
//,tasks: ["dev",'sass:dist']
23+
}
24+
}
25+
26+
27+
//Sass ===============================
28+
var sass;
29+
config.sass = sass = {};
30+
31+
//distribution
32+
sass.dist = {
33+
options: {
34+
style: "compressed",
35+
noCache: true,
36+
sourcemap: 'none',
37+
update: true
38+
},
39+
files: {
40+
"<%= src.distFolder %>": "<%= src.sassMain %>"
41+
}
42+
};
43+
44+
//development env.
45+
sass.dev = {
46+
options: {
47+
style: "expanded",
48+
lineNumber: true,
49+
},
50+
files: {
51+
"<%= src.devFolder %>": "<%= src.sassMain %>"
52+
}
53+
};
54+
55+
//grunt serve ===============================
56+
config.connect = {
57+
server: {
58+
options: {
59+
livereload: true,
60+
port: "<%= src.serverPort %>"
61+
}
62+
}
63+
};
64+
65+
66+
67+
//Register custom tasks ===============================
68+
grunt.registerTask('default', ['dev']);
69+
grunt.registerTask('dev', ['sass:dev']);
70+
grunt.registerTask('dist', ['sass:dist']);
71+
grunt.registerTask('serve', ['connect:server', 'watch']);
72+
require('time-grunt')(grunt);
73+
require('load-grunt-tasks')(grunt, {
74+
scope: 'devDependencies'
75+
});
76+
77+
78+
//General setup ===============================
79+
grunt.initConfig(config);
80+
81+
};

README.md

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ angular-slick-carousel
66
Angular directive for [slick-carousel](http://kenwheeler.github.io/slick/)
77

88

9-
## Summary
9+
## Summary
1010

1111
- [Usage](#usage)
1212
- [Attributes & Event](#attributes--event)
@@ -29,7 +29,7 @@ Angular directive for [slick-carousel](http://kenwheeler.github.io/slick/)
2929
```html
3030
<link rel="stylesheet" href="../bower_components/slick-carousel/slick/slick.css">
3131
<link rel="stylesheet" href="../bower_components/slick-carousel/slick/slick-theme.css">
32-
32+
3333
<script src="../bower_components/jquery/jquery.js"></script>
3434
<script src="../bower_components/angular/angular.js"></script>
3535
<script src="../bower_components/slick-carousel/slick/slick.js"></script>
@@ -50,8 +50,8 @@ as either a `<div>` attribute or a `<slick>` element.
5050
<slick infinite=true slides-to-show=3 slides-to-scroll=3>
5151
...
5252
</slick>
53-
54-
<slick
53+
54+
<slick
5555
settings="slickConfig" ng-if="numberLoaded">
5656
</slick>
5757
```
@@ -66,7 +66,7 @@ as either a `<div>` attribute or a `<slick>` element.
6666
$scope.slickConfig = {
6767
enabled: true,
6868
autoplay: true,
69-
draggable: false,
69+
draggable: false,
7070
autoplaySpeed: 3000,
7171
method: {},
7272
event: {
@@ -95,7 +95,7 @@ Slick can be easily switched on and off by using `enabled` settings flag.
9595
```
9696

9797

98-
## Method
98+
## Method
9999
1. All the functions in the plugin are exposed through a control
100100
attribute.
101101
2. To utilize this architecture, and have two-way data-binding,
@@ -118,7 +118,7 @@ as shown in the example.
118118
<button ng-click='slickConfig.method.slickPause()'>slickPause()</button>
119119
```
120120

121-
## Slide data
121+
## Slide data
122122
For change slide content, you have to set `ng-if` to destroy and init it
123123

124124
- controller:
@@ -127,9 +127,9 @@ For change slide content, you have to set `ng-if` to destroy and init it
127127
$scope.numberLoaded = true;
128128
$scope.numberUpdate = function(){
129129
$scope.numberLoaded = false; // disable slick
130-
130+
131131
//number update
132-
132+
133133
$scope.numberLoaded = true; // enable slick
134134
};
135135
```
@@ -138,25 +138,25 @@ For change slide content, you have to set `ng-if` to destroy and init it
138138
<script type="text/ng-template" id="tpl.html">
139139
<h3>{{ i.label }}</h3>
140140
</script>
141-
141+
142142
<slick ng-if="numberLoaded">
143143
<div ng-repeat="i in number">
144144
<div class="" ng-include="'tpl.html'"></div>
145145
</div>
146146
</slick>
147147
```
148148

149-
## Global config
149+
## Global config
150150
```js
151151
config(['slickCarouselConfig', function (slickCarouselConfig) {
152152
slickCarouselConfig.dots = true;
153153
slickCarouselConfig.autoplay = false;
154154
}])
155155
```
156156

157-
## FAQ
157+
## FAQ
158158
Q: After change data, could i keep the current slide index?
159-
A: For this directive, this will destroy and init slick when updating data. You could get current index by event.
159+
A: For this directive, this will destroy and init slick when updating data. You could get current index by event.
160160
example:
161161
```js
162162
$scope.currentIndex = 0;
@@ -174,20 +174,15 @@ example:
174174

175175
## Examples
176176

177-
You need be running a server to see the samples:
178-
179-
Go to your terminal and run:
177+
Now to run the samples in your local machine you just need to run:
180178

181179
```sh
182-
python -m SimpleHTTPServer
183-
184-
```
185-
after this command you will be loading a python Server in you local machine in most the cases loads in the port 8000, you will be able to see the port when the server starts like that:
186-
```sh
187-
Serving HTTP on 0.0.0.0 port 8000 ...
180+
grunt serve
188181
```
189182

190-
so you can see the samples with this adress: http://localhost:8000/examples/#/
183+
so you will start a web server on http://localhost:8000
184+
185+
now acess the folder examples: http://localhost:8000/examples/#/
191186

192187

193188
## Creator

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"load-grunt-tasks": "^3.5.0",
1717
"time-grunt": "^1.3.0",
1818
"grunt-contrib-sass": "*",
19+
"grunt-contrib-connect": "^1.0.2",
1920
"grunt-contrib-watch": "*",
2021
"gulp-autoprefixer": "~2.3.1",
2122
"gulp-angular-templatecache": "~1.6.0",

0 commit comments

Comments
 (0)