Skip to content
This repository was archived by the owner on Feb 5, 2024. It is now read-only.

Commit 297cbc8

Browse files
committed
Merge pull request crowi#40 from crowi/remove-bower
Remove bower
2 parents 992f93a + 546b765 commit 297cbc8

File tree

10 files changed

+464
-87
lines changed

10 files changed

+464
-87
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
![Crowi](http://res.cloudinary.com/hrscywv4p/image/upload/c_limit,f_auto,h_900,q_80,w_1200/v1/199673/https_www_filepicker_io_api_file_VpYEP32ZQyCZ85u6XCXo_zskpra.png)
2+
13
Crowi - The Simple & Powerful Communication Tool Based on Wiki
24
================================================================
35

bower.json

-32
This file was deleted.

gulpfile.js

+48-18
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ var concat = require('gulp-concat');
88
var rename = require('gulp-rename');
99
var uglify = require('gulp-uglify');
1010
var jshint = require('gulp-jshint');
11+
var source = require('vinyl-source-stream');
12+
var browserify = require('browserify');
1113

1214
var stylish = require('jshint-stylish');
1315

@@ -29,27 +31,30 @@ var css = {
2931
src: dirs.cssSrc + '/' + pkg.name + '.scss',
3032
main: dirs.cssDist + '/crowi-main.css',
3133
dist: dirs.cssDist + '/crowi.css',
34+
revealSrc: dirs.cssSrc + '/' + pkg.name + '-reveal.scss',
35+
revealDist: dirs.cssDist + '/crowi-reveal.css',
3236
watch: ['resource/css/*.scss'],
3337
};
3438

3539
var js = {
40+
browserify: {
41+
crowi: 'resource/js/crowi.js', // => crowi-bundled.js
42+
crowiPresentation: 'resource/js/crowi-presentation.js', // => crowi-presentation.js
43+
},
3644
src: [
37-
'bower_components/jquery/dist/jquery.js',
38-
'bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js',
39-
'bower_components/inline-attachment/src/inline-attachment.js',
40-
'bower_components/inline-attachment/src/jquery.inline-attachment.js',
45+
'node_modules/jquery/dist/jquery.js',
46+
'node_modules/bootstrap-sass/assets/javascripts/bootstrap.js',
47+
'node_modules/inline-attachment/src/inline-attachment.js',
4148
'node_modules/socket.io-client/socket.io.js',
42-
'bower_components/marked/lib/marked.js',
43-
'bower_components/jquery.cookie/jquery.cookie.js',
44-
'bower_components/jquery-selection/src/jquery.selection.js',
45-
'bower_components/highlightjs/highlight.pack.js',
46-
'resource/js/crowi.js'
49+
'node_modules/jquery.cookie/jquery.cookie.js',
50+
'resource/thirdparty-js/jquery.selection.js',
51+
dirs.jsDist + '/crowi-bundled.js',
4752
],
4853
dist: dirs.jsDist + '/crowi.js',
4954
revealSrc: [
50-
'bower_components/reveal.js/lib/js/head.min.js',
51-
'bower_components/reveal.js/lib/js/html5shiv.js',
52-
'bower_components/reveal.js/js/reveal.js'
55+
'node_modules/reveal.js/lib/js/head.min.js',
56+
'node_modules/reveal.js/lib/js/html5shiv.js',
57+
dirs.jsDist + '/crowi-presentation.js',
5358
],
5459
revealDist: dirs.jsDist + '/crowi-reveal.js',
5560
formSrc: [
@@ -63,12 +68,24 @@ var js = {
6368
};
6469

6570
var cssIncludePaths = [
66-
'bower_components/bootstrap-sass-official/assets/stylesheets',
67-
'bower_components/fontawesome/scss',
68-
'bower_components/reveal.js/css'
71+
'node_modules/bootstrap-sass/assets/stylesheets',
72+
'node_modules/font-awesome/scss',
73+
'node_modules/reveal.js/css'
6974
];
7075

71-
gulp.task('js:concat', function() {
76+
gulp.task('js:browserify', function() {
77+
browserify({entries: js.browserify.crowiPresentation})
78+
.bundle()
79+
.pipe(source('crowi-presentation.js'))
80+
.pipe(gulp.dest(dirs.jsDist));
81+
82+
return browserify({entries: js.browserify.crowi})
83+
.bundle()
84+
.pipe(source('crowi-bundled.js'))
85+
.pipe(gulp.dest(dirs.jsDist));
86+
});
87+
88+
gulp.task('js:concat', ['js:browserify'], function() {
7289
gulp.src(js.revealSrc)
7390
.pipe(concat('crowi-reveal.js'))
7491
.pipe(gulp.dest(dirs.jsDist));
@@ -115,23 +132,36 @@ gulp.task('test', function() {
115132
});
116133

117134
gulp.task('css:sass', function() {
135+
gulp.src(css.revealSrc) // reveal
136+
.pipe(sass({
137+
outputStyle: 'nesed',
138+
sourceComments: 'map',
139+
includePaths: cssIncludePaths
140+
}).on('error', sass.logError))
141+
.pipe(gulp.dest(dirs.cssDist));
142+
118143
return gulp.src(css.src)
119144
.pipe(sass({
120145
outputStyle: 'nesed',
121146
sourceComments: 'map',
122147
includePaths: cssIncludePaths
123148
}).on('error', sass.logError))
124-
.pipe(rename({suffix: '-main'}))
149+
.pipe(rename({suffix: '-main'})) // create -main.css to prepare concating with highlight.js's css
125150
.pipe(gulp.dest(dirs.cssDist));
126151
});
127152

128153
gulp.task('css:concat', ['css:sass'], function() {
129-
return gulp.src([css.main, 'bower_components/highlightjs/styles/tomorrow-night.css'])
154+
return gulp.src([css.main, 'node_modules/highlight.js/styles/tomorrow-night.css'])
130155
.pipe(concat('crowi.css'))
131156
.pipe(gulp.dest(dirs.cssDist))
132157
});
133158

134159
gulp.task('css:min', ['css:concat'], function() {
160+
gulp.src(css.revealDist)
161+
.pipe(cssmin())
162+
.pipe(rename({suffix: '.min'}))
163+
.pipe(gulp.dest(dirs.cssDist));
164+
135165
return gulp.src(css.dist)
136166
.pipe(cssmin())
137167
.pipe(rename({suffix: '.min'}))

lib/views/page_presentation.html

+4-32
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
88

99

10-
<link rel="stylesheet" type="text/css" href="/css/crowi-reveal.css">
11-
<link rel="stylesheet" type="text/css" href="/bower_components/reveal.js/lib/css/zenburn.css">
10+
<link rel="stylesheet" type="text/css" href="/css/crowi-reveal{% if env == 'production' %}.min{% endif %}.css">
11+
<link rel="stylesheet" type="text/css" href="/js/reveal.js/lib/css/zenburn.css">
1212

1313
<title>{{ path|path2name }} | {{ path }}</title>
1414
</head>
@@ -27,35 +27,7 @@
2727
</div>
2828
</div>
2929

30-
<script src="/js/crowi-reveal.js"></script>
31-
<script>
32-
Reveal.initialize({
33-
controls: true,
34-
progress: true,
35-
history: true,
36-
center: true,
37-
transition: 'slide',
38-
39-
// Optional libraries used to extend on reveal.js
40-
dependencies: [
41-
{ src: '/bower_components/reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
42-
{ src: '/bower_components/reveal.js/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
43-
{ src: '/bower_components/reveal.js/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
44-
{ src: '/bower_components/reveal.js/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
45-
{ src: '/bower_components/reveal.js/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
46-
{ src: '/bower_components/reveal.js/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
47-
]
48-
});
49-
50-
Reveal.addEventListener('ready', function(event) {
51-
// event.currentSlide, event.indexh, event.indexv
52-
$('.reveal section').each(function(e) {
53-
var $self = $(this);
54-
if ($self.children().length == 1) {
55-
$self.addClass('only');
56-
}
57-
});
58-
});
59-
</script>
30+
<script src="/js/crowi{% if env == 'production' %}.min{% endif %}.js"></script>
31+
<script src="/js/crowi-reveal{% if env == 'production' %}.min{% endif %}.js"></script>
6032
</body>
6133
</html>

package.json

+13-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
"basic-auth-connect": "~1.0.0",
3434
"bluebird": "~3.0.5",
3535
"body-parser": "~1.14.1",
36-
"bower": "~1.7.1",
36+
"bootstrap-sass": "~3.3.6",
37+
"browserify": "~12.0.1",
3738
"cli": "~0.6.0",
3839
"connect-flash": "~0.1.1",
3940
"connect-redis": "~2.1.0",
@@ -45,6 +46,7 @@
4546
"express-form": "~0.12.0",
4647
"express-session": "~1.12.0",
4748
"facebook-node-sdk": "=0.1.10",
49+
"font-awesome": "~4.5.0",
4850
"googleapis": "=0.4.7",
4951
"gulp": "~3.9.0",
5052
"gulp-concat": "~2.6.0",
@@ -55,8 +57,13 @@
5557
"gulp-spawn-mocha": "~2.2.1",
5658
"gulp-uglify": "~1.4.2",
5759
"gulp-watch": "~4.3.5",
60+
"highlight.js": "~9.0.0",
61+
"inline-attachment": "git+https://github.com/Rovak/InlineAttachment.git#2.0.2",
62+
"jquery": "~2.1.4",
63+
"jquery.cookie": "~1.4.1",
5864
"jshint-stylish": "~2.1.0",
5965
"kerberos": "0.0.17",
66+
"marked": "~0.3.5",
6067
"method-override": "~2.3.1",
6168
"mongoose": "4.2.5",
6269
"mongoose-paginate": "4.2.0",
@@ -65,10 +72,12 @@
6572
"nodemailer": "~1.2.2",
6673
"nodemailer-ses-transport": "~1.1.0",
6774
"redis": "~0.12.1",
75+
"reveal.js": "~3.2.0",
6876
"socket.io": "~1.3.0",
6977
"socket.io-client": "~1.3.0",
7078
"swig": "~1.4.0",
71-
"time": "~0.11.0"
79+
"time": "~0.11.0",
80+
"vinyl-source-stream": "~1.1.0"
7281
},
7382
"devDependencies": {
7483
"chai": "~1.10.0",
@@ -81,7 +90,8 @@
8190
"scripts": {
8291
"start": "node app.js",
8392
"test": "gulp test",
84-
"postinstall": "bower cache clean && bower install && gulp"
93+
"build": "gulp",
94+
"postinstall": "gulp"
8595
},
8696
"env": {
8797
"NODE_ENV": "production"

public/fonts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../bower_components/fontawesome/fonts
1+
../node_modules/font-awesome/fonts

resource/css/crowi-reveal.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import 'reveal';
1+
@import 'reveal.scss';
22
@import 'theme/source/black';
33

44
.reveal {

resource/js/crowi-presentation.js

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
var Reveal = require('reveal.js');
2+
3+
if (!window) {
4+
window = {};
5+
}
6+
window.Reveal = Reveal;
7+
8+
Reveal.initialize({
9+
controls: true,
10+
progress: true,
11+
history: true,
12+
center: true,
13+
transition: 'slide',
14+
15+
// Optional libraries used to extend on reveal.js
16+
dependencies: [
17+
{ src: '/js/reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
18+
{ src: '/js/reveal.js/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
19+
{ src: '/js/reveal.js/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
20+
{ src: '/js/reveal.js/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
21+
{ src: '/js/reveal.js/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
22+
{ src: '/js/reveal.js/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
23+
]
24+
});
25+
26+
Reveal.addEventListener('ready', function(event) {
27+
// event.currentSlide, event.indexh, event.indexv
28+
$('.reveal section').each(function(e) {
29+
var $self = $(this);
30+
if ($self.children().length == 1) {
31+
$self.addClass('only');
32+
}
33+
});
34+
});

resource/js/crowi.js

+7
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@
33
/* Author: Sotaro KARASAWA <[email protected]>
44
*/
55

6+
var hljs = require('highlight.js');
7+
var marked = require('marked');
68
var Crowi = {};
79

10+
if (!window) {
11+
window = {};
12+
}
13+
window.Crowi = Crowi;
14+
815
Crowi.createErrorView = function(msg) {
916
$('#main').prepend($('<p class="alert-message error">' + msg + '</p>'));
1017
};

0 commit comments

Comments
 (0)