Skip to content

Commit 837829f

Browse files
committed
fix(build): fix CodeMirror css issue
1 parent 2aa64a9 commit 837829f

File tree

7 files changed

+37
-347
lines changed

7 files changed

+37
-347
lines changed

Ch2_HowToWrite/promise-and-array.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
1919
次からのサンプルでは `http://azu.github.io/promises-book/json/comment.json` という `azu.github.io` ドメイン以下にあるリソースを取得する例が登場します。
2020
21-
ブラウザでは、同一ドメインではないリソースを許可なく取得することはできません。そのため、 次のサンプルコードは http://azu.github.io/promises-book/[http://azu.github.io/promises-book/]上でないと動作しないことに注意してください。
21+
ブラウザでは、同一ドメインではないリソースを許可なく取得することはできません。そのため、 次のサンプルコードは http://azu.github.io/promises-book/[http://azu.github.io/promises-book/] 上でないと動作しないことに注意してください。
2222
23-
また、 http://httpbin.org/[httpbin.org] というドメインがリソース取得の例として登場します。
23+
一方、 http://httpbin.org/[httpbin.org] というドメインがリソース取得の例として登場します。
2424
こちらは、同一ドメインでなくてもリソースの取得が許可されています。
2525
====
2626

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test:
1313
html:
1414
@echo "Generate HTML..."
1515
@npm run embed
16-
@npm run build-js
16+
@npm run build
1717
@echo "Building asciidoc"
1818
@./_tools/build.sh
1919
@echo "Done! => ${OUTPUT_FILE}"

docinfo.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,5 @@
2020
href="https://github.com/azu/promises-book/releases.atom">
2121
<link href="public/img/favicon.ico" rel="shortcut icon" type="image/x-icon">
2222
<link rel="icon" sizes="16x16 32x32" href="public/img/favicon.ico">
23-
<link rel="stylesheet" type="text/css" href="public/css/overload.css"/>
24-
<link rel="stylesheet" type="text/css" href="node_modules/codemirror/lib/codemirror.css"/>
25-
<link rel="stylesheet" type="text/css" href="public/css/mirror-console-compoenent.css">
23+
<link rel="stylesheet" type="text/css" href="public/css/build/all.css"/>
2624
<script type="text/javascript" src="public/js/build/app.js" async defer></script>

gulpfile.js

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,56 @@
11
"use strict";
22
var gulp = require("gulp");
33
var path = require("path");
4+
var concat = require('gulp-concat');
45
var rename = require("gulp-rename");
56
var inlining = require("gulp-inlining-node-require");
67
var removeUseString = require("gulp-remove-use-strict");
78
var browserify = require('browserify');
89
var minifyify = require("minifyify");
910
var source = require('vinyl-source-stream');
1011
var sourceFile = "./public/js/index.js";
11-
var destDir = "./public/js/build/";
12-
gulp.task("build-js", function () {
12+
var destCSSDir = "./public/css/build/";
13+
var destJSDir = "./public/js/build/";
14+
gulp.task("build-css", function() {
15+
return gulp.src([
16+
"./node_modules/codemirror/lib/codemirror.css",
17+
"./public/css/mirror-console-component.css",
18+
"./public/css/overload.css"
19+
])
20+
.pipe(concat('all.css'))
21+
.pipe(gulp.dest(destCSSDir));
22+
});
23+
gulp.task("build-js", function() {
1324
return browserify(sourceFile)
1425
.bundle()
1526
.pipe(source("app.js"))
16-
.pipe(gulp.dest(destDir));
27+
.pipe(gulp.dest(destJSDir));
1728
});
18-
gulp.task("build-js-min", function () {
29+
gulp.task("build-js-min", function() {
1930
return browserify({
20-
debug: true
21-
})
31+
debug: true
32+
})
2233
.add(sourceFile)
2334
.plugin('minifyify', {
2435
map: 'app.min.js.map',
25-
output: destDir + 'app.min.js.map',
26-
compressPath: function (p) {
36+
output: destJSDir + 'app.min.js.map',
37+
compressPath: function(p) {
2738
return path.relative('./', p);
2839
}
2940
})
3041
.bundle()
3142
.pipe(source("app.js"))
32-
.pipe(gulp.dest(destDir));
43+
.pipe(gulp.dest(destJSDir));
3344
});
34-
gulp.task("embed", function () {
45+
gulp.task("embed", function() {
3546
var replacePowerAssert = require("./_tools/gulp/replate-power-assert.js");
36-
return gulp.src(["./Ch*/src/**/*.js", "./Ch*/lib/*.js", "./Ch3_Testing/test/*.js"], {base: './'})
47+
return gulp.src(["./Ch*/src/**/*.js", "./Ch*/lib/*.js", "./Ch3_Testing/test/*.js"], { base: './' })
3748
.pipe(inlining())
3849
.pipe(replacePowerAssert())
3950
.pipe(removeUseString({
4051
force: true
4152
}))
42-
.pipe(rename(function (filePath) {
53+
.pipe(rename(function(filePath) {
4354
var filePathBySplit = filePath.dirname.split(path.sep);
4455
filePathBySplit.pop();
4556
// src 以下の階層
@@ -51,15 +62,15 @@ gulp.task("embed", function () {
5162
}))
5263
.pipe(gulp.dest("./"));
5364
});
54-
gulp.task("lint-html", function (callback) {
65+
gulp.task("lint-html", function(callback) {
5566
require("native-promise-only");
5667
var File = require("./Ch4_AdvancedPromises/src/promise-chain/fs-promise-chain");
5768
var checkHTML = require("./test/html/missing-internal-link").checkInternalLinks;
5869

59-
var htmlPromise = File.read("index.html").then(function (contents) {
70+
var htmlPromise = File.read("index.html").then(function(contents) {
6071
var errors = checkHTML(contents);
6172
if (errors.length > 0) {
62-
errors.forEach(function (error) {
73+
errors.forEach(function(error) {
6374
console.error(error.message);
6475
});
6576
return callback(new Error("Found lint error"));
@@ -71,6 +82,6 @@ gulp.task("lint-html", function (callback) {
7182
Promise.all([htmlPromise, asciidocPromise])
7283
.catch(callback);
7384
});
74-
gulp.on('err', function (error) {
85+
gulp.on('err', function(error) {
7586
process.exit(1);
7687
});

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"main": "index.js",
1111
"scripts": {
12-
"build-js": "gulp build-js",
12+
"build": "gulp build-js build-css",
1313
"build-js-min": "gulp build-js-min",
1414
"embed": "gulp embed",
1515
"lint-html": "gulp lint-html",
@@ -35,12 +35,13 @@
3535
"devDependencies": {
3636
"brfs": "^1.2.0",
3737
"browserify": "^13.0.0",
38-
"cheerio": "^0.20.0",
38+
"cheerio": "^0.22.0",
3939
"espower-loader": "^1.0.0",
40-
"esprima": "^2.0.0",
40+
"esprima": "^3.1.1",
4141
"esprima-fb": "^4001.1.0-dev-harmony-fb",
42-
"fs-extra": "^0.30.0",
42+
"fs-extra": "^1.0.0",
4343
"gulp": "^3.8.11",
44+
"gulp-concat": "^2.6.1",
4445
"gulp-inlining-node-require": "0.0.3",
4546
"gulp-remove-use-strict": "0.0.2",
4647
"gulp-rename": "~1.2.0",
@@ -50,7 +51,7 @@
5051
"intelli-espower-loader": "^1.0.0",
5152
"minifyify": "^7.0.1",
5253
"mocha": "^3.0.2",
53-
"nock": "^8.0.0",
54+
"nock": "^9.0.2",
5455
"power-assert": "^1.1.0",
5556
"promise-test-helper": "^0.2.1",
5657
"q": "^1.0.1",

0 commit comments

Comments
 (0)