-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Embed CSS to generated html file #4
Comments
I have a similar problem generating one html file from multiple include files with embedded css using gulp.src('arc42-template.adoc')
.pipe(asciidoctor({
safe: 'unsafe',
doctype: 'book',
header_footer: true,
attributes: ['showtitle', 'toc', 'toc-position=left']
}))
.pipe(gulp.dest('dest')); Resulted in
I currently fixed it by changing the asciidoctor-core-min.js file in _node_modules\gulp-asciidoctor\node_modules\asciidoctor.js\dist\npm_ (first renamed asciidoctor-core.js to asciidoctor-core-min.js): //return ((($a = self.primary_stylesheet_data) !== false && $a !== nil) ? $a : self.primary_stylesheet_data = (($b = $opal.Object._scope.IO) == null ? $opal.cm('IO') : $b).$read((($b = $opal.Object._scope.File) == null ? $opal.cm('File') : $b).$join($scope.STYLESHEETS_DATA_PATH, "asciidoctor.css")).$chomp());
return ((($a = self.primary_stylesheet_data) !== false && $a !== nil) ? $a : self.primary_stylesheet_data = (($b = $opal.Object._scope.File) == null ? $opal.cm('File') : $b).$read((($b = $opal.Object._scope.File) == null ? $opal.cm('File') : $b).$join($scope.STYLESHEETS_DATA_PATH, "asciidoctor.css")).$chomp()); Then I got the next error:
Fixed it again by changing a line in asciidoctor-core-min.js: //$opal.cdecl($scope, 'STYLESHEETS_DATA_PATH', (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$join($scope.DATA_PATH, "stylesheets"));
$opal.cdecl($scope, 'STYLESHEETS_DATA_PATH', (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$join("node_modules\\gulp-asciidoctor\\node_modules\\asciidoctor.js\\dist", "css")); |
@padupuy , linkcss is a attribute. so it shoud be used as
sorry, it's not tested yet. |
@dongwq thanks for your answer but I try to add the attribute parameter and it didn't work. Here is my gulp task gulp.task('generate-doc', function() {
var destFolder = 'target/doc/';
gulp.src('doc/**/*.adoc')
.pipe(asciidoctor({
attributes: ['showtitle', 'linkcss!']
}))
.pipe(gulp.dest(destFolder));
}); |
Works for me when setting the "safe" option to 'unsafe' (not false). .pipe(asciidoctor({
safe: 'unsafe',
attributes: ['showtitle', 'linkcss!']
})) |
@patlau when I add the safe argument, I got the same kind of problem as you \node_modules\gulp-asciidoctor\node_modules\asciidoctor.js\dist\npm\asciidoctor-core.min.js:9
primary_stylesheet_data=(null==(d=a.Object._scope.IO)?a.cm("IO"):d).$read((nul
^
TypeError: Object IO has no method '$read'
at g.j.$primary_stylesheet_data (D:\Ws\Ci_Iznogoud\node_modules\gulp-asciidoctor\node_modules\asciidoctor.js\dist\npm\asciidoctor-core.min.js:9:22247)
at g.j.$embed_primary_stylesheet (D:\Ws\Ci_Iznogoud\node_modules\gulp-asciidoctor\node_modules\asciidoctor.js\dist\npm\asciidoctor-core.min.js:9:22439)
at h.j.$document (D:\Ws\Ci_Iznogoud\node_modules\gulp-asciidoctor\node_modules\asciidoctor.js\dist\npm\asciidoctor-core.min.js:4:19377)
at h.$opal.defn.TMP_1 (D:\Ws\Ci_Iznogoud\node_modules\gulp-asciidoctor\node_modules\asciidoctor.js\node_modules\opal-npm-wrapper\index.js:1793:21)
at h.i.$convert (D:\Ws\Ci_Iznogoud\node_modules\gulp-asciidoctor\node_modules\asciidoctor.js\dist\npm\asciidoctor-core.min.js:4:8231)
at i.o.$convert (D:\Ws\Ci_Iznogoud\node_modules\gulp-asciidoctor\node_modules\asciidoctor.js\dist\npm\asciidoctor-core.min.js:6:18069)
at OpalModule.b._proto.$convert (D:\Ws\Ci_Iznogoud\node_modules\gulp-asciidoctor\node_modules\asciidoctor.js\dist\npm\asciidoctor-core.min.js:10:29517)
at Transform._transform (D:\Ws\Ci_Iznogoud\node_modules\gulp-asciidoctor\index.js:47:30)
at Transform._read (_stream_transform.js:179:10)
at Transform._write (_stream_transform.js:167:12) |
This should work now. Use the Asciidoctor option 'standalone'. |
Which option can I set to embed asciidoctor css to my generated html ?
I try to set linkcss to true, but without success.
I also try to find an option to copy the asciidoctor css in the same destination folder but it still to be "./asciidoctor.css"
Here is my code
The text was updated successfully, but these errors were encountered: