Giter Club home page Giter Club logo

Comments (4)

nippur72 avatar nippur72 commented on August 22, 2024

so do you want to write

/// #if my-custom-define

and have it turned into

/// #if my_custom_define

?

I don't think that is possible because what comes after the #if is meant to be generic JavaScript expression.

Can you please explain your use case? Why not just use my_custom_define from the beginning?

from ifdef-loader.

jgranick avatar jgranick commented on August 22, 2024

From this example in the docs:

const opts = {
   DEBUG: true,
   version: 3,
   "ifdef-verbose": true,       // add this for verbose output
   "ifdef-triple-slash": false  // add this to use double slash comment instead of default triple slash
};

I think it's natural for people to define MY_UPPERCASE_DEFINE or my-lowercase-define, but my-lowercase-define doesn't currently work.

Perhaps incoming options should have dashes turned into underscores, automatically, so:

const opts = {
   DEBUG: true,
   version: 3,
   "ifdef-verbose": true,       // add this for verbose output
   "ifdef-triple-slash": false  // add this to use double slash comment instead of default triple slash
};

Would work with

/// #if ifdef_verbose

and

/// #if ifdef_triple_slash

The truth is that we are porting a library to JavaScript, which supports -Dlowercase-dashed-defines in the original language. Similar to the format of the ifdef-loader specific defines above, it would be nice to be able to preserve this for consistency of documentation... and don't dashes feel nice?

from ifdef-loader.

nippur72 avatar nippur72 commented on August 22, 2024

I agree that the docs are not very clear. ifdef-verbose and ifdef-triple-slash are not actual symbols available for #if, they are special switches used to configure the tool itself. And that's why they have - in their names: name clashing with user defined symbols isn't possible because they ain't valid JavaScript identifiers.

from ifdef-loader.

jgranick avatar jgranick commented on August 22, 2024

Oh yeah, I understand 😄

I just mean, ifdef-verbose feels nice. ifdef_verbose feels a little funny. I don't think these defines (themselves) are necessary in other source files, but a quick sanitize on the define names might be nice and make this pattern valid for user defines, too

from ifdef-loader.

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.