Skip to content
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

adds css front matter escapes #814

Closed
wants to merge 1 commit into from
Closed

adds css front matter escapes #814

wants to merge 1 commit into from

Conversation

pflannery
Copy link
Contributor

I have a scenario with sass files where if front matter exists in a scss file and I then try to compile it outside of docpad an error "Syntax error: Invalid CSS after "-": expected number or function, was "--cson""

This is caused by sass not being able to recognise the 3 char front matter sequences like ### or ---.

I've created a solution that escapes the front matter using css commenting like this:

/*---cson
author: "super ted"
info: "123"
---*/

The advantages of this also allows sass\css editors to render the document correctly without reporting errors and discolouring the output.

@greduan
Copy link
Contributor

greduan commented Mar 2, 2014

I would merge. :) 👍

@balupton
Copy link
Member

Accomplished this is in a different way with v6.66.0. Thanks a bunch for pushing for this. It's now out and really cool!

@balupton balupton closed this May 23, 2014
balupton added a commit that referenced this pull request May 23, 2014
- Meta header seperators can now contain additional characaters, providing there is still a character that repeats at least 3 times

	This allows you to do things like:

	```
	/* ---
	works: "yes"
	--- */

	window.alert(<%- @document.works %>)
	```

	Or even more concisely:

	```
	/***
	works: "yes"
	***/

	window.alert(<%- @document.works %>)
	```

	Big thanks to [pflannery](https://github.com/pflannery) for pushing for this with [#814](#814)
@pflannery
Copy link
Contributor Author

Great thanks ben!!

@tbusser
Copy link

tbusser commented Jun 20, 2014

This completely breaks all of my SCSS files in DocPad as I've been using

/* ================
   SECTION NAME
   ============= */

for as long as I can remember to mark section within a file. It took me a while to find out it was due to this new feature in DocPad. Is there anyway this feature can be switched off?

@balupton
Copy link
Member

@tbusser as long as your file doesn't start with one of your section headers you're fine, if you add a comment or something to the top of the file and you'll be good. There is currently no way to turn this feature off, nor will it probably be a priority due to the increased complexity vs the workaround just mentioned.

@tbusser
Copy link

tbusser commented Jun 20, 2014

@balupton Unfortunately my files do start with such a header comment. I understand this is not a big priority, just not too happy about having to alter all my files so my project will build again. It would've been nice if the check was for a repetition of three chars and evaluate to false when it is more than 3 (point me in the right direction, as to which file to look into, and I'll have a crack at it myself).

@balupton
Copy link
Member

It would've been nice if the check was for a repetition of three chars and evaluate to false when it is more than 3 (point me in the right direction, as to which file to look into, and I'll have a crack at it myself).

The problem with this is it trades one break for another. There's definitely a few people out there who use more than 3 chars for there meta data headers.

I think doing an option to suppress the error may be an option?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants