Giter Club home page Giter Club logo

Comments (10)

jonschlinkert avatar jonschlinkert commented on May 19, 2024 1

what if we did gray-matter-lite or something, then we could require that into this module for the time being to keep the API the same here.

from gray-matter.

tech4him1 avatar tech4him1 commented on May 19, 2024 1

This is working as of version 3.0.6. Thanks!

from gray-matter.

jonschlinkert avatar jonschlinkert commented on May 19, 2024 1

This is working as of version 3.0.6. Thanks!

Great! I was going to ask. Thanks!

from gray-matter.

jonschlinkert avatar jonschlinkert commented on May 19, 2024

just saw this comment. That might be a solution too.

from gray-matter.

tech4him1 avatar tech4him1 commented on May 19, 2024

Another way that would work for us if you don't want to change the sources would be to have a re-packaged version for browsers that was run through Babel or something like that and left out the Node functions like matter.read/fs.

If we did it that way, then you should be able to build the sources however you want, then publish it as two separate packages (maybe gray-matter and gray-matter-browser or something like that).

from gray-matter.

jonschlinkert avatar jonschlinkert commented on May 19, 2024

If we did it that way, then you should be able to build the sources however you want, then publish it as two separate packages (maybe gray-matter and gray-matter-browser or something like that).

yeah, that's not a bad idea. Let me think about it for a little bit (today). @doowb?

from gray-matter.

tech4him1 avatar tech4him1 commented on May 19, 2024

Another option if we are just considering fs is wrapping the require in an if:

if (require) { require('fs'); }

I'd still have to test this though, I'm not sure that it works with WebPack.

from gray-matter.

tech4him1 avatar tech4him1 commented on May 19, 2024

That sounds really good.

from gray-matter.

doowb avatar doowb commented on May 19, 2024

I like the idea of having a separate module with browser compatible features that is then required into gray-matter.

The if(require) { require('fs'); } won't work for webpack because webpack does static analysis to determine which modules to include by looking at the require keyword.

Another option that might work is for gray-matter to add a browser property to package.json with {"fs": false} since webpack supports the package browser field spec now. I haven't tested this to know if it would work for you or not.

from gray-matter.

erquhart avatar erquhart commented on May 19, 2024

That would be awesome.

from gray-matter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.