Skip to content

Commit

Permalink
fix(build): fix CodeMirror css issue
Browse files Browse the repository at this point in the history
  • Loading branch information
azu committed Nov 20, 2016
1 parent 2aa64a9 commit 837829f
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 347 deletions.
4 changes: 2 additions & 2 deletions Ch2_HowToWrite/promise-and-array.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
次からのサンプルでは `http://azu.github.io/promises-book/json/comment.json` という `azu.github.io` ドメイン以下にあるリソースを取得する例が登場します。
ブラウザでは、同一ドメインではないリソースを許可なく取得することはできません。そのため、 次のサンプルコードは http://azu.github.io/promises-book/[http://azu.github.io/promises-book/]上でないと動作しないことに注意してください。
ブラウザでは、同一ドメインではないリソースを許可なく取得することはできません。そのため、 次のサンプルコードは http://azu.github.io/promises-book/[http://azu.github.io/promises-book/] 上でないと動作しないことに注意してください。
また、 http://httpbin.org/[httpbin.org] というドメインがリソース取得の例として登場します。
一方、 http://httpbin.org/[httpbin.org] というドメインがリソース取得の例として登場します。
こちらは、同一ドメインでなくてもリソースの取得が許可されています。
====

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test:
html:
@echo "Generate HTML..."
@npm run embed
@npm run build-js
@npm run build
@echo "Building asciidoc"
@./_tools/build.sh
@echo "Done! => ${OUTPUT_FILE}"
Expand Down
4 changes: 1 addition & 3 deletions docinfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,5 @@
href="https://github.com/azu/promises-book/releases.atom">
<link href="public/img/favicon.ico" rel="shortcut icon" type="image/x-icon">
<link rel="icon" sizes="16x16 32x32" href="public/img/favicon.ico">
<link rel="stylesheet" type="text/css" href="public/css/overload.css"/>
<link rel="stylesheet" type="text/css" href="node_modules/codemirror/lib/codemirror.css"/>
<link rel="stylesheet" type="text/css" href="public/css/mirror-console-compoenent.css">
<link rel="stylesheet" type="text/css" href="public/css/build/all.css"/>
<script type="text/javascript" src="public/js/build/app.js" async defer></script>
43 changes: 27 additions & 16 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,56 @@
"use strict";
var gulp = require("gulp");
var path = require("path");
var concat = require('gulp-concat');
var rename = require("gulp-rename");
var inlining = require("gulp-inlining-node-require");
var removeUseString = require("gulp-remove-use-strict");
var browserify = require('browserify');
var minifyify = require("minifyify");
var source = require('vinyl-source-stream');
var sourceFile = "./public/js/index.js";
var destDir = "./public/js/build/";
gulp.task("build-js", function () {
var destCSSDir = "./public/css/build/";
var destJSDir = "./public/js/build/";
gulp.task("build-css", function() {
return gulp.src([
"./node_modules/codemirror/lib/codemirror.css",
"./public/css/mirror-console-component.css",
"./public/css/overload.css"
])
.pipe(concat('all.css'))
.pipe(gulp.dest(destCSSDir));
});
gulp.task("build-js", function() {
return browserify(sourceFile)
.bundle()
.pipe(source("app.js"))
.pipe(gulp.dest(destDir));
.pipe(gulp.dest(destJSDir));
});
gulp.task("build-js-min", function () {
gulp.task("build-js-min", function() {
return browserify({
debug: true
})
debug: true
})
.add(sourceFile)
.plugin('minifyify', {
map: 'app.min.js.map',
output: destDir + 'app.min.js.map',
compressPath: function (p) {
output: destJSDir + 'app.min.js.map',
compressPath: function(p) {
return path.relative('./', p);
}
})
.bundle()
.pipe(source("app.js"))
.pipe(gulp.dest(destDir));
.pipe(gulp.dest(destJSDir));
});
gulp.task("embed", function () {
gulp.task("embed", function() {
var replacePowerAssert = require("./_tools/gulp/replate-power-assert.js");
return gulp.src(["./Ch*/src/**/*.js", "./Ch*/lib/*.js", "./Ch3_Testing/test/*.js"], {base: './'})
return gulp.src(["./Ch*/src/**/*.js", "./Ch*/lib/*.js", "./Ch3_Testing/test/*.js"], { base: './' })
.pipe(inlining())
.pipe(replacePowerAssert())
.pipe(removeUseString({
force: true
}))
.pipe(rename(function (filePath) {
.pipe(rename(function(filePath) {
var filePathBySplit = filePath.dirname.split(path.sep);
filePathBySplit.pop();
// src 以下の階層
Expand All @@ -51,15 +62,15 @@ gulp.task("embed", function () {
}))
.pipe(gulp.dest("./"));
});
gulp.task("lint-html", function (callback) {
gulp.task("lint-html", function(callback) {
require("native-promise-only");
var File = require("./Ch4_AdvancedPromises/src/promise-chain/fs-promise-chain");
var checkHTML = require("./test/html/missing-internal-link").checkInternalLinks;

var htmlPromise = File.read("index.html").then(function (contents) {
var htmlPromise = File.read("index.html").then(function(contents) {
var errors = checkHTML(contents);
if (errors.length > 0) {
errors.forEach(function (error) {
errors.forEach(function(error) {
console.error(error.message);
});
return callback(new Error("Found lint error"));
Expand All @@ -71,6 +82,6 @@ gulp.task("lint-html", function (callback) {
Promise.all([htmlPromise, asciidocPromise])
.catch(callback);
});
gulp.on('err', function (error) {
gulp.on('err', function(error) {
process.exit(1);
});
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"main": "index.js",
"scripts": {
"build-js": "gulp build-js",
"build": "gulp build-js build-css",
"build-js-min": "gulp build-js-min",
"embed": "gulp embed",
"lint-html": "gulp lint-html",
Expand All @@ -35,12 +35,13 @@
"devDependencies": {
"brfs": "^1.2.0",
"browserify": "^13.0.0",
"cheerio": "^0.20.0",
"cheerio": "^0.22.0",
"espower-loader": "^1.0.0",
"esprima": "^2.0.0",
"esprima": "^3.1.1",
"esprima-fb": "^4001.1.0-dev-harmony-fb",
"fs-extra": "^0.30.0",
"fs-extra": "^1.0.0",
"gulp": "^3.8.11",
"gulp-concat": "^2.6.1",
"gulp-inlining-node-require": "0.0.3",
"gulp-remove-use-strict": "0.0.2",
"gulp-rename": "~1.2.0",
Expand All @@ -50,7 +51,7 @@
"intelli-espower-loader": "^1.0.0",
"minifyify": "^7.0.1",
"mocha": "^3.0.2",
"nock": "^8.0.0",
"nock": "^9.0.2",
"power-assert": "^1.1.0",
"promise-test-helper": "^0.2.1",
"q": "^1.0.1",
Expand Down

0 comments on commit 837829f

Please sign in to comment.