Skip to content

Commit

Permalink
新增 - 使用 Sass & css 改为 gulp 压缩
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Oct 8, 2016
1 parent 06e0fe5 commit 421d04f
Show file tree
Hide file tree
Showing 11 changed files with 130 additions and 44 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ node_modules/
qrcode.png

src/main/webapp/js/*.min.js
src/main/webapp/css/*.min.css
nb-configuration.xml
53 changes: 48 additions & 5 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,43 @@
* @file frontend tool.
*
* @author <a href="mailto:[email protected]">Liyuan Li</a>
* @version 1.2.2.0, Sep 20, 2016
* @version 1.3.2.0, Oct 8, 2016
*/

'use strict';

var gulp = require("gulp");
var concat = require('gulp-concat');
var cleanCSS = require('gulp-clean-css');
var uglify = require('gulp-uglify');
var sourcemaps = require("gulp-sourcemaps");
var sass = require('gulp-sass');
var clean = require('gulp-clean');
var rename = require('gulp-rename');

gulp.task('sass', function () {
return gulp.src('./src/main/webapp/scss/*.scss')
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
.pipe(gulp.dest('./src/main/webapp/css'));
});

gulp.task('sass:watch', function () {
gulp.watch('./src/main/webapp/scss/*.scss', ['sass']);
});


gulp.task('clean', function () {
// remove min css
return gulp.src('./src/main/webapp/css/*.min.css', {read: false})
.pipe(clean());
});

gulp.task('build', function () {
// min css
gulp.src('./src/main/webapp/css/*.css')
.pipe(cleanCSS())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('./src/main/webapp/css/'));

gulp.task('cc', function () {
// css
gulp.src('./src/main/webapp/js/lib/editor/codemirror.css')
.pipe(cleanCSS())
Expand Down Expand Up @@ -67,9 +95,24 @@ gulp.task('cc', function () {
.pipe(concat('libs.min.js'))
.pipe(gulp.dest('./src/main/webapp/js/lib/compress/'));

var jsArticleLib = ['./src/main/webapp/js/lib/editor/codemirror.min.js',
var jsArticleLib = [
// start codemirror.min.js
'./src/main/webapp/js/lib/editor/diff_match_patch.js',
'./src/main/webapp/js/lib/editor/codemirror.js',
'./src/main/webapp/js/lib/editor/placeholder.js',
'./src/main/webapp/js/lib/editor/merge.js',
'./src/main/webapp/js/overwrite/codemirror/addon/hint/show-hint.js',
'./src/main/webapp/js/lib/editor/editor.js',
'./src/main/webapp/js/lib/to-markdown.js',
// end codemirror.min.js
'./src/main/webapp/js/lib/highlight.js-9.6.0/highlight.pack.js',
'./src/main/webapp/js/lib/jquery/file-upload-9.10.1/jquery.fileupload.min.js',
// start jquery.fileupload.min.js
'./src/main/webapp/js/lib/jquery/file-upload-9.10.1/vendor/jquery.ui.widget.js',
'./src/main/webapp/js/lib/jquery/file-upload-9.10.1/jquery.iframe-transport.js',
'./src/main/webapp/js/lib/jquery/file-upload-9.10.1/jquery.fileupload.js',
'./src/main/webapp/js/lib/jquery/file-upload-9.10.1/jquery.fileupload-process.js',
'./src/main/webapp/js/lib/jquery/file-upload-9.10.1/jquery.fileupload-validate.js',
// end jquery.fileupload.min.js
'./src/main/webapp/js/lib/sound-recorder/SoundRecorder.js',
'./src/main/webapp/js/lib/jquery/jquery.qrcode.min.js',
'./src/main/webapp/js/lib/zeroclipboard/ZeroClipboard.min.js'];
Expand Down
21 changes: 12 additions & 9 deletions nb-configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@ The configuration is intended to be shared among all the users of project and
therefore it is assumed to be part of version control checkout.
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
-->
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
<!--
Properties that influence various parts of the IDE, especially code formatting and the like.
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
That way multiple projects can share the same settings (useful for formatting rules for example).
Any value defined here will override the pom.xml file value but is only applicable to the current project.
-->
<org-netbeans-modules-web-clientproject-api.Gulp_2e_task_2e_1>cc</org-netbeans-modules-web-clientproject-api.Gulp_2e_task_2e_1>
</properties>
<spellchecker-wordlist xmlns="http://www.netbeans.org/ns/spellchecker-wordlist/1">
<word>admin</word>
<word>app</word>
Expand Down Expand Up @@ -57,4 +48,16 @@ Any value defined here will override the pom.xml file value but is only applicab
<word>Verifycodes</word>
<word>whitelist</word>
</spellchecker-wordlist>
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
<!--
Properties that influence various parts of the IDE, especially code formatting and the like.
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
That way multiple projects can share the same settings (useful for formatting rules for example).
Any value defined here will override the pom.xml file value but is only applicable to the current project.
-->
<org-netbeans-modules-web-clientproject-api.Gulp_2e_task_2e_1>cc</org-netbeans-modules-web-clientproject-api.Gulp_2e_task_2e_1>
<org-netbeans-modules-css-prep.sass_2e_configured>true</org-netbeans-modules-css-prep.sass_2e_configured>
<org-netbeans-modules-css-prep.sass_2e_enabled>true</org-netbeans-modules-css-prep.sass_2e_enabled>
<org-netbeans-modules-css-prep.sass_2e_mappings>/scss:/css</org-netbeans-modules-css-prep.sass_2e_mappings>
</properties>
</project-shared-configuration>
60 changes: 31 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
{
"name": "Symphony",
"version": "1.3.0",
"description": "A real-time community forum written in Java. Java 实时社区论坛。 https://hacpai.com ",
"homepage": "https://github.com/b3log/symphony",
"repository": {
"type": "git",
"url": "git://github.com/b3log/symphony.git"
"name": "Symphony",
"version": "1.3.0",
"description": "A real-time community forum written in Java. Java 实时社区论坛。 https://hacpai.com ",
"homepage": "https://github.com/b3log/symphony",
"repository": {
"type": "git",
"url": "git://github.com/b3log/symphony.git"
},
"bugs": {
"url": "https://github.com/b3log/symphony/issues"
},
"license": "Apache License",
"private": true,
"author": "Daniel <[email protected]> (http://88250.b3log.org) & Vanessa <[email protected]> (http://vanessa.b3log.org)",
"maintainers": [
{
"name": "Daniel",
"email": "[email protected]"
},
"bugs": {
"url": "https://github.com/b3log/symphony/issues"
},
"license": "Apache License",
"private": true,
"author": "Daniel <[email protected]> (http://88250.b3log.org) & Vanessa <[email protected]> (http://vanessa.b3log.org)",
"maintainers": [
{
"name": "Daniel",
"email": "[email protected]"
},
{
"name": "Vanessa",
"email": "[email protected]"
}
],
"devDependencies": {
"gulp": "3.9.0",
"gulp-concat": "2.6.0",
"gulp-clean-css": "2.0.6",
"gulp-uglify": "1.5.1",
"gulp-sourcemaps": "1.6.0"
{
"name": "Vanessa",
"email": "[email protected]"
}
],
"devDependencies": {
"gulp": "3.9.0",
"gulp-clean": "^0.3.2",
"gulp-clean-css": "2.0.6",
"gulp-concat": "2.6.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.3.2",
"gulp-uglify": "1.5.1"
}
}
1 change: 1 addition & 0 deletions src/main/webapp/css/base.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/main/webapp/css/error.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/main/webapp/css/home.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 421d04f

Please sign in to comment.