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

Support CSON. #43

Open
sorahn opened this issue Mar 29, 2014 · 10 comments
Open

Support CSON. #43

sorahn opened this issue Mar 29, 2014 · 10 comments

Comments

@sorahn
Copy link

sorahn commented Mar 29, 2014

Support for a CSON files seems to be right up the ally here. And with atom, and github pushing coffeescript and CSON I think we'll be seeing more and more of it.

Cheers.

@kennethormandy
Copy link
Collaborator

I started on this, but I think I decided it’s beyond my abilities since it wouldn’t just be a preprocesor. It would have to support harp.cson, _data.cson, etc. But there are failing tests in that branch if someone else wants to take a crack at it.

@sintaxi
Copy link
Owner

sintaxi commented Apr 8, 2014

I would hold off on CSON. I think HJSON suits our needs much better.

http://laktak.github.io/hjson/

@sorahn
Copy link
Author

sorahn commented Apr 11, 2014

@kennethormandy I got all the valid CSON tests passing in my branch. It doesn't support harp.cson yet, but wouldn't you simply be able to edit harp to use terraform to parse it's own config file? Hopefully this helps!

@sorahn
Copy link
Author

sorahn commented Apr 11, 2014

@sintaxi CSON is currently switching their parser (coffescript) for a static one (cson-safe). Is there any reason to not finish the CSON one and then add HJSON as a 'data' parser too? After that YAML could probably be plugged in as well. YAML isn't really a pre-processor.

@kennethormandy
Copy link
Collaborator

Woah, looks promising! Failing tests 1–3 are because I thought CSON would need to error like the other preprocessors: by showing something in the browser. (This stuff happens in lib/javascript etc.)

I supposed you could argue that it should follow what JSON does right now and just fail and throw an error outright. In that case, those tests would need to be different. Otherwise, CSON would kind of need to be implemented in two places: once as a preprocessor and once for the _data.json files, etc.

The last failing test looks related to that. Because you can go examplefile.json.jade to output a JSON file, some part of this implementation is conflicting with that (I think exports.isDataFile is too aggressive)

I’m glad you’re working on this, we seem to have a pretty solid group of people who want whitespace significant everything. I’m definitely onboard, and personally I think adding comments or not breaking when JSON doesn’t have comments doesn’t conflict with adding CSON.

@sorahn
Copy link
Author

sorahn commented Apr 11, 2014

@kennethormandy OK, I'll probably be able to take another stab at this sometime later this weekend. Feel free to run with some of the work I did if you want to poke around some more.

I've got CSON in 2 places right now, where it's used for _data.json I'm just running it through the regular CSON parser, instead of the render function. Kind of a stop gap to just see if I could get it working. Ideally every parsed file could just be requested through the normal render.

Re: isDataFile, yeah, you're right, I'll clean that up to only match the extension.

@valtido
Copy link

valtido commented Oct 13, 2014

@drbrts https://github.com/atom/season I think, this should be simple enough to read a file, then export it as .json. Hope it helps.

@rwxrob
Copy link

rwxrob commented Mar 9, 2015

What's the state of this. I have a course catalog organized as an _data directory that currently I build into _data.json so that Harp serves it properly. Harp handles the .coffeescript and I wonder if building directly into a single .coffee would be better since it gets served up as a single .js file. The goal for me is to just save edits to the individual .cson files and have them be compiled, cached, etc automatically (without any db saves of course).

@og2t
Copy link

og2t commented Mar 27, 2015

+1, since CSON is essentially CoffeeScript, it shouldn't be an issue? Or?

@vbwx
Copy link
Contributor

vbwx commented Jun 30, 2015

HJSON sounds like a great idea! I'll give it a try this weekend, I think.

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

No branches or pull requests

7 participants