Comments (2)
I would veer towards modifying the Handlebar file where appropriate rather than adding additional options, if possible - that's what it's there for. Simplest solution in this instance would be to move the entire {{ > assets }}
down, like so:
context.write(' <'+'body>');
context.write(result.innerHTML);
context.write(' {{> assets}}');
context.write(' <'+'/'+'body>');
But then, yes, splitting assets into header and footer can also work. You would need a way to decide how and where they are included, however. Can it be on a component-by-component basis? Should it?
from sassdown.
Hmm, but having style tags in body isn't allowed I think. There is a scoped
attribute in html5 which would allow this but it looks like browser support is not good yet. But if this was supported it would be a good option.
Maybe splitting the assets automatically based on the tag is the best option then. This way the handlebar template can stay the same and if needed the {{> assets}} can be replaced by a {{> styles}} and a {{> scripts}} can be added at the end of body. This solution should be good enough for almost all cases I think.
To give you an idea here is what I changed locally:
var localStyles = '';
var localScripts = '';
// Generate path to assets for this file
Sassdown.config.assets.forEach( function (asset) {
var assetString = Sassdown.include(asset, path.dirname(page.dest))
localAssets += assetString;
// Also add the asset to either localScript or localStyles for greater flexibility.
if (assetString.indexOf('<script') !== -1) {
localScripts += assetString;
}
else {
localStyles += assetString;
}
});
[...]
Handlebars.registerPartial('styles', localStyles);
Handlebars.registerPartial('scripts', localScripts);
from sassdown.
Related Issues (20)
- Document which browsers and versions the project intends to support HOT 1
- Tag versions HOT 1
- Iframe height=0 HOT 6
- Publish a bugfix to registry HOT 1
- intendation "rules" unclear HOT 4
- Warning: Cannot read property 'orig' of undefined HOT 5
- Empty files object returns cryptic error message
- Unable to nest markdown in comments. HOT 3
- Would be nice to allow specific ordering of styleguide sections
- Rename sassdown to grunt-sassdown HOT 2
- Sassdown should be decoupled from Grunt HOT 7
- Sassdown should be caller-agnostic (gulp, grunt, streams) HOT 1
- Sassdown should have functional test coverage HOT 1
- Method for setting up categories of patterns? HOT 2
- Independent code comments separate from regular css comments HOT 2
- Output to JSON HOT 2
- Sassdown index file misnamed
- Typekit
- 1.0.0?
- The fix merged in #92 isn't available through npm install sassdown HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sassdown.