docpad/docpad-skeleton-bootstrap

Bootstrap repo copied to out directory

Opened this issue · 0 comments

jmjf commented

If the Bootstrap repo is in static or files, the entire repo gets copied to the out directory. This wastes space and time (about 90 seconds per generate for me) and is generally not a good idea.

Workaround 1

mkdir src/norender
mv src/files/vendor src/norender
cp src/norender/vendor/twitter-bootstrap/dist/fonts/* src/files/fonts
cp src/norender/vendor/twitter-bootstrap/dist/js/bootstrap.min.js src/files/scripts

Edit src/documents/styles/twitter-bootstrap.css.less to import from ../../norender/vendor instead of ../../files/vendor

Workaround 2

mkdir src/norender
mv src/files/vendor src/norender

Use docpad-plugin-copy (npm) to copy font and js files. (untested)

Based on the README, add something like this to docpad.coffee

plugins:
    copy:
        boostrap-fonts:
            src: 'norender/vendor/twitter-bootstrap/dist/fonts'
            out: 'fonts'
        bootstrap-js:
            src: 'norender/vendor/twitter-bootstrap/dist/js'
            out: 'scripts'

I looked at docpad-plugin-raw but it does not seem to support the customized output folder required--unless you want to use the command option.

I haven't tested the last part of Workaround 2 yet. It does offer the advantage of keeping the Bootstrap fonts and js current if you update Bootstrap.

Some sites don't need all the Bootstrap js features. A better workaround would be on that can customize bootstrap.min.js to include only the necessary js files.