GitbookIO / plugin-styles-sass

SASS custom stylesheets instead of CSS
Apache License 2.0
9 stars 10 forks source link

How can this work? #3

Closed ddidier closed 8 years ago

ddidier commented 8 years ago

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)
);
ddidier commented 8 years ago

See f50305427be83c2a435fc0fae4cafaa54b527652 for my ugly temporary fix

SamyPesse commented 8 years ago

Sorry for the delay, it'll fix with latest GitBook version( https://github.com/GitbookIO/gitbook/commit/becd027563f361e7dc6824d18c58978b08aa6118)

ddidier commented 8 years ago

thanks, that's working now