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

Add CSON parsing support #224

Merged
merged 1 commit into from
Jul 11, 2018
Merged

Conversation

lenovouser
Copy link
Contributor

@lenovouser lenovouser commented Jul 11, 2018

Basically JSON for coffeescript.

github.com/bevry/cson

@jamuhl
Copy link
Member

jamuhl commented Jul 11, 2018

Are there still people using coffeescript?!?

Will merge this asap...and publish update

@lenovouser
Copy link
Contributor Author

lenovouser commented Jul 11, 2018

I don't know about CoffeeScript - I am actually using TypeScript, but for files I mostly use CSON because I like the clean syntax 😄

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.6%) to 93.617% when pulling 373855f on lenovouser:add-cson-support into 95a0cb5 on i18next:master.

@jamuhl jamuhl merged commit 67f3301 into i18next:master Jul 11, 2018
@jamuhl
Copy link
Member

jamuhl commented Jul 11, 2018

thank you for your contribution - published in i18next-node-fs-backend@1.2.0

@lenovouser lenovouser deleted the add-cson-support branch August 8, 2018 12:13
@pariz
Copy link

pariz commented Aug 14, 2018

This commit pretty much killed using this package through webpack.

@jamuhl
Copy link
Member

jamuhl commented Aug 14, 2018

@pariz...webpack...on serverside..or used in electron...

if having issues i guess we could rollback this....as not a must have feature to have a coffeescript parser...(who uses coffeescript anyways)

@lenovouser
Copy link
Contributor Author

you can use this module in the browser / webpack? Didn't know that. How exactly does it break webpack? We could roll this back I suppose. Generally I thought it should be pretty easy to add a method for extending file format support. So you could just add support by doing e.g.:

{
  // path where resources get loaded from
  loadPath: '/locales/{{lng}}/{{ns}}.json',

  // path to post missing resources
  addPath: '/locales/{{lng}}/{{ns}}.missing.json',

  // jsonIndent to use when storing json files
  jsonIndent: 2,

  // additional file extension / syntax support
  loaders: {
    cson: (data: string) => {
       return CSON.parse(data);
    },
  },
}

@jamuhl wdyt?

@jamuhl
Copy link
Member

jamuhl commented Aug 14, 2018

@lenovouser agree - we have the same on the i18next-xhr-backend it's just called parse there: https://github.com/i18next/i18next-xhr-backend#backend-options

@jamuhl
Copy link
Member

jamuhl commented Aug 17, 2018

@lenovouser @pariz

i18next-node-fs-backend@2.0.0 -> removes cson parser and adds options.parse to set a custom parser

hope you both can live with that solution

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.

None yet

4 participants