Skip to content

Commit 7cacb5e

Browse files
committed
Add node dependencies and bower dependencies, build basic structure for project, create gulp file to build front end code.
1 parent 86a4440 commit 7cacb5e

File tree

8 files changed

+155
-0
lines changed

8 files changed

+155
-0
lines changed

.bowerrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory": "app/bower_components"
3+
}

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
bower_components/

app/index.html

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="zh-CN">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>变量名词库 - 杭州抽象科技</title>
6+
<link rel="stylesheet" href="styles/main.min.css">
7+
<script src="bower_components/angularjs/angular.min.js"></script>
8+
<script src="scripts/app.js"></script>
9+
</head>
10+
<body ng-app="abstackVarLib">
11+
</body>
12+
</html>

app/scripts/app.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* abstackVarLib Module
3+
*
4+
* Description: main
5+
*/
6+
angular.module('abstackVarLib', []);

app/styles/main.less

Whitespace-only changes.

bower.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "Abstack-variables-library",
3+
"version": "0.0.1",
4+
"homepage": "https://github.com/PeachScript/Abstack-variables-library",
5+
"authors": [
6+
7+
],
8+
"description": "Variables library for Abstack Tech",
9+
"moduleType": [
10+
"node"
11+
],
12+
"keywords": [
13+
"Variables",
14+
"Library",
15+
"Abstack",
16+
"Tech"
17+
],
18+
"license": "MIT",
19+
"ignore": [
20+
"**/.*",
21+
"node_modules",
22+
"bower_components",
23+
"test",
24+
"tests"
25+
],
26+
"dependencies": {
27+
"angularjs": "1.2.27"
28+
}
29+
}

gulpfile.js

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
var gulp = require('gulp'),
2+
connect = require('gulp-connect'),
3+
less = require('gulp-less'),
4+
minifyCss = require('gulp-minify-css'),
5+
rename = require('gulp-rename'),
6+
gutil = require('gulp-util'),
7+
conf = {
8+
rootDir: './app',
9+
serverPort: 5005,
10+
livePort: 35727,
11+
lessPath: './app/styles/**/*.less',
12+
jsPath: './app/scripts/**/*.js',
13+
htmlPath: './app/**/*.html',
14+
};
15+
16+
gulp.task('default', ['runserver', 'watch']);
17+
18+
gulp.task('runserver', function(){
19+
connect.server({
20+
root: conf.rootDir,
21+
port: conf.serverPort,
22+
livereload: {
23+
port: conf.livePort
24+
}
25+
});
26+
});
27+
28+
gulp.task('watch', function(){
29+
gulp.watch(conf.lessPath, lessTask);
30+
gulp.watch(conf.htmlPath, notifyReload);
31+
gulp.watch(conf.jsPath, notifyReload);
32+
});
33+
34+
gulp.task('less', function(){lessTask()});
35+
36+
function lessTask(event){
37+
if(event)
38+
gutil.log('Compiling ' + gutil.colors.cyan('less') + '...');
39+
gulp.src(conf.lessPath)
40+
.pipe(less())
41+
.pipe(gulp.dest(conf.rootDir + '/styles/'))
42+
.pipe(minifyCss({
43+
keepSpecialComments: 0
44+
}))
45+
.pipe(rename({
46+
extname: '.min.css'
47+
}))
48+
.pipe(gulp.dest(conf.rootDir + '/styles/'));
49+
50+
if(event){
51+
gutil.log(gutil.colors.cyan('Less') + ' has been compiled.');
52+
notifyReload(event);
53+
}
54+
}
55+
56+
function getFileName(file){
57+
return file.substring(file.lastIndexOf('/') + 1);
58+
}
59+
60+
function notifyReload(event){
61+
if(!event.path || !event)
62+
return;
63+
gulp.src(event.path)
64+
.pipe(connect.reload(
65+
gutil.log(
66+
gutil.colors.magenta(getFileName(getFileName(event.path)))
67+
+ ' was reloaded.'
68+
)
69+
));
70+
}

package.json

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "Abstack-variables-library",
3+
"version": "0.0.1",
4+
"description": "Variables library for Abstack Tech",
5+
"main": "none",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "https://github.com/PeachScript/Abstack-variables-library.git"
12+
},
13+
"keywords": [
14+
"Variables",
15+
"Library",
16+
"Abstack",
17+
"Tech"
18+
],
19+
"author": "Peach <[email protected]>",
20+
"license": "MIT",
21+
"bugs": {
22+
"url": "https://github.com/PeachScript/Abstack-variables-library/issues"
23+
},
24+
"homepage": "https://github.com/PeachScript/Abstack-variables-library",
25+
"devDependencies": {
26+
"gulp": "^3.8.10",
27+
"gulp-connect": "^2.2.0",
28+
"gulp-less": "^1.3.6",
29+
"gulp-minify-css": "^0.3.11",
30+
"gulp-rename": "^1.2.0",
31+
"gulp-util": "^3.0.1"
32+
}
33+
}

0 commit comments

Comments
 (0)