Skip to content

Commit 64a5d5e

Browse files
committed
jqquery ui add
1 parent 60f7a11 commit 64a5d5e

File tree

12 files changed

+124
-3511
lines changed

12 files changed

+124
-3511
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,11 @@ test.sqlite
2424
.ropeproject
2525
_themes
2626
_build
27+
phantomjsdriver.log
28+
29+
# Bower
30+
bower_components
31+
32+
# JavaScript
33+
node_modules
34+

gulpfile.js

Lines changed: 66 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,84 @@
11
var autoprefixer = require('gulp-autoprefixer'),
2+
batch = require('gulp-batch'),
23
concat = require('gulp-concat'),
34
gulp = require('gulp'),
5+
gutil = require('gulp-util'),
46
minifyCSS = require('gulp-minify-css'),
7+
newer = require('gulp-newer'),
8+
sourcemaps = require('gulp-sourcemaps'),
59
watch = require('gulp-watch');
610

7-
var _ = require("underscore"),
8-
glob = require("glob"),
9-
minimatch = require("minimatch");
11+
var browserify = require('browserify'),
12+
browserSync = require('browser-sync'),
13+
buffer = require('vinyl-buffer'),
14+
map = require('vinyl-map'),
15+
mainBowerFiles = require('main-bower-files'),
16+
source = require('vinyl-source-stream');
1017

11-
function getFiles(path) {
12-
var files = glob.sync(path + '**/*.css');
13-
target = minimatch.match(files, '__*.css', { matchBase: true });
14-
ignore = _.map(target, function(item){ return '!' + item; });
15-
result = files.concat(ignore);
16-
return result;
17-
}
18+
gulp.task('browser-sync', function() {
19+
browserSync({
20+
proxy: "127.0.0.1:6543",
21+
logLevel: "silent",
22+
});
23+
});
1824

19-
gulp.task('css', function() {
25+
gulp.task('bower', function() {
26+
gulp.src(mainBowerFiles({filter: (/.*\.png$/i)}), { base: 'bower_components' })
27+
.pipe(gulp.dest('./pyramid_sacrud_pages/static/css/__bower_components/'))
28+
.pipe(map(function(code, filename) { gutil.log('Bower Images ' + gutil.colors.green(filename));
29+
}))
30+
gulp.src(mainBowerFiles({filter: (/.*\.css$/i)}), { base: 'bower_components' })
31+
.pipe(gulp.dest('./pyramid_sacrud_pages/static/css/__bower_components/'))
32+
.pipe(map(function(code, filename) { gutil.log('Bower CSS ' + gutil.colors.green(filename));
33+
}))
34+
});
2035

21-
var path = glob.sync('./*/static/css/'),
22-
concatFiles = getFiles(path);
36+
gulp.task('browserify', function() {
37+
browserify('./pyramid_sacrud_pages/static/js/main.js')
38+
.bundle()
39+
.pipe(source('__pyramid_sacrud_pages.js'))
40+
.pipe(buffer())
41+
.pipe(sourcemaps.init({loadMaps: true}))
42+
.pipe(sourcemaps.write('./'))
43+
.pipe(gulp.dest('./pyramid_sacrud_pages/static/js/'))
44+
.pipe(map(function(code, filename) { gutil.log('Browserify ' + gutil.colors.green(filename)); }))
45+
.pipe(browserSync.reload({ stream:true }));
46+
});
2347

24-
gulp.src(concatFiles)
48+
gulp.task('css', function() {
49+
path = ['./pyramid_sacrud_pages/static/css/*.css',
50+
'./pyramid_sacrud_pages/static/css/**/*.css',
51+
'!./pyramid_sacrud_pages/static/css/__pyramid_sacrud_pages.css'];
52+
gulp.src(path)
53+
.pipe(newer('./pyramid_sacrud_pages/static/css/__pyramid_sacrud_pages.css'))
54+
.pipe(sourcemaps.init())
2555
.pipe(autoprefixer({
26-
browsers: [
27-
'Firefox >= 3',
28-
'Explorer >= 6',
29-
'Opera >= 9',
30-
'Chrome >= 15',
31-
'Safari >= 4',
32-
'> 1%'],
56+
browsers: ['Firefox >= 3', 'Explorer >= 6', 'Opera >= 9', 'Chrome >= 15', 'Safari >= 4', '> 1%'],
3357
cascade: false
3458
}))
59+
.on('error', function(err) {
60+
gutil.log(gutil.colors.red('Autoprefixer Error'), gutil.colors.yellow(err.message));
61+
})
3562
.pipe(minifyCSS())
36-
.pipe(concat('__pages.css'))
37-
.pipe(gulp.dest(path + '/'));
63+
.pipe(concat('__pyramid_sacrud_pages.css'))
64+
.pipe(sourcemaps.write('.'))
65+
.pipe(gulp.dest('./pyramid_sacrud_pages/static/css/'))
66+
.pipe(map(function(code, filename) { gutil.log('CSS ' + gutil.colors.green(filename)); }))
67+
.on('error', gutil.log)
68+
.pipe(browserSync.reload({ stream:true }));
3869
});
3970

40-
gulp.task('watch', function () {
41-
42-
var path = glob.sync('./*/static/*/'),
43-
watchFiles = getFiles(path);
44-
45-
watch(watchFiles, function (files) {
46-
gulp.start('css', cb);
47-
});
71+
gulp.task('watch', function() {
72+
watch(['./pyramid_sacrud_pages/static/css/*.css',
73+
'./pyramid_sacrud_pages/static/css/**/*.css',
74+
'!./pyramid_sacrud_pages/static/css/__pyramid_sacrud_pages.css'], { verbose: true }, batch(function () {
75+
gulp.start('css');
76+
}));
77+
watch(['./pyramid_sacrud_pages/static/js/*.js',
78+
'./pyramid_sacrud_pages/static/js/**/*.js',
79+
'!./pyramid_sacrud_pages/static/js/__pyramid_sacrud_pages.js'], { verbose: true }, batch(function () {
80+
gulp.start('browserify');
81+
}));
4882
});
4983

50-
gulp.task('default', ['watch']);
84+
gulp.task('default', ['watch', 'browser-sync']);

package.json

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "pyramid_sacrud_pages",
3-
"title": "Pyramid Sacrud Pages",
4-
"description": "Pages plugin for Pyramid SQLAlchemy CRUD",
5-
"version": "0.0.2",
3+
"title": "Pyramid SACRUD Pages",
4+
"description": "pyramid_sacrud_pages provides a collections of pages to your Pyramid application. This is very similar to django.contrib.flatpages but with a tree structure and traversal algorithm in URL dispath.",
5+
"version": "0.0.4",
66
"homepage": "https://github.com/ITCase/pyramid_sacrud_pages",
77
"author": {
88
"name": "ITCase",
@@ -23,13 +23,49 @@
2323
"node": ">= 0.8.0"
2424
},
2525
"devDependencies": {
26-
"glob": "^4.1.3",
27-
"gulp": "^3.8.10",
28-
"gulp-autoprefixer": "^1.0.1",
29-
"gulp-concat": "^2.4.1",
30-
"gulp-minify-css": "^0.3.11",
31-
"gulp-watch": "^1.2.0",
32-
"minimatch": "^1.0.0",
33-
"underscore": "^1.7.0"
26+
"browser-sync": "^2.5.0",
27+
"browserify": "^9.0.3",
28+
"browserify-shim": "^3.8.3",
29+
"chai": "^2.2.0",
30+
"cheerio": "^0.19.0",
31+
"gulp": "^3.8.11",
32+
"gulp-autoprefixer": "^2.1.0",
33+
"gulp-batch": "~1.0.5",
34+
"gulp-concat": "^2.5.2",
35+
"gulp-minify-css": "^1.0.0",
36+
"gulp-newer": "^0.5.0",
37+
"gulp-sourcemaps": "^1.5.1",
38+
"gulp-util": "^3.0.4",
39+
"gulp-watch": "^4.2.2",
40+
"main-bower-files": "^2.6.2",
41+
"mocha": "^2.2.1",
42+
"phantomjs": "^1.9.16",
43+
"selenium-webdriver": "2.45",
44+
"vinyl-buffer": "^1.0.0",
45+
"vinyl-map": "^1.0.1",
46+
"vinyl-source-stream": "^1.1.0"
47+
},
48+
"scripts": {
49+
"test": "mocha -b --timeout 999999 pyramid_sacrud_pages/static/js/tests/"
50+
},
51+
"browserify": {
52+
"transform": [
53+
"browserify-shim"
54+
]
55+
},
56+
"browser": {
57+
"jquery": "./bower_components/jquery/dist/jquery.min.js",
58+
"jquery-ui": "./bower_components/jquery-ui/ui/minified/jquery-ui.min.js",
59+
"jqtree": "./bower_components/jqtree/tree.jquery.js",
60+
"speakingurl": "./bower_components/speakingurl/speakingurl.min.js"
61+
},
62+
"browserify-shim": {
63+
"jquery": "$",
64+
"jquery-ui": {
65+
"depends": "jquery"
66+
},
67+
"jqtree": {
68+
"depends": "jquery"
69+
}
3470
}
3571
}

pyramid_sacrud_pages/static/css/__pages.css

Lines changed: 0 additions & 2 deletions
This file was deleted.
-239 Bytes
Binary file not shown.

pyramid_sacrud_pages/static/css/jqtree.css

Lines changed: 0 additions & 144 deletions
This file was deleted.

0 commit comments

Comments
 (0)