This plugin makes it easy to use SASS custom stylesheets instead of CSS for your book.
Add it to your book.json
, with some custom stylesheets:
{
"plugins": ["styles-sass"],
"styles": {
"pdf": "./styles/pdf.sass"
}
}
SASS custom stylesheets instead of CSS
License: Apache License 2.0
First I'm no JS or Node expert. I followed the simple instructions on the README page but that wasn't working. After much debugging with my limited knowledge I came to the conclusion that cannot possibly work or I'm really missing something.
In website.js
in prepareStyles
at line 52 : that.book.resolve(stylePath)
is resolving the style path against the source root and not the generated _book
directory. So it's working for a static file which is already there but not for a generated one which will be in the _book
directory.
The only workaround I see without touching gitbook is to generated the CSS in the source, ie:
// Temporary CSS file
var tmpfile = filename.replace(/(sass|scss)$/i, "css");
// Replace config
book.config.set('styles.'+type, tmpfile);
return renderSASS(
book.resolve(filename),
path.resolve(tmpfile)
);
I tried work in Windows
Problem:
Install style-sass work hard; depends [email protected]
Cannot download "https://github.com/sass/node-sass/releases/download/v3.4.1/win32-x64-51_binding.node":
at Visual Studio 2015 Comm. (v140) / msbuild solo install (v120)
Resolved:
npm install -g node-sass(current version 4.0.0) are fine.
this package binary safe
Regerd.
Got following error after updating to Node.js v6.0.0:
Error: Error loading plugins: gitbook-plugin-styles-sass. Run 'gitbook install' to install plugins from NPM.
gitbook install finished without warnings.
Hello ! Thanks for this plugin development, SASS would be very useful for sure.
Unfortunately, I can't manage to make it work.
I've tried :
book.json
then gitbook install
npm i gitbook-plugin-styles-sass --save-dev
then gitbook serve
"plugins": ["styles-sass"]
and the "plugins": ["[email protected]"]
syntax.What did I miss ?
I've got an error when using this plugin, but I don't know why. I'm using NVM with node 5.1.
{
"plugins": [
"[email protected]"
],
"styles": {
"website": "styles/website.css"
}
}
{ nvm: 5.1.0 }
% gitbook install
info: 1 plugins to install
info: install plugin styles-sass from npm (gitbook-plugin-styles-sass) with version 1.0.0
info: >> plugin styles-sass installed with success
Done, without error
{ nvm: 5.1.0 }
% gitbook build
info: loading book configuration....OK
info: load plugin gitbook-plugin-styles-sass ....ERROR
info: load plugin gitbook-plugin-highlight ....OK
Error: Error loading plugins: gitbook-plugin-styles-sass. Run "gitbook install" to install plugins from NPM.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.