Giter Site home page Giter Site logo

amarcruz / jscc Goto Github PK

View Code? Open in Web Editor NEW
52.0 52.0 7.0 245 KB

Tiny and powerful preprocessor for conditional comments and replacement of compile-time variables in text files

License: MIT License

Makefile 1.12% JavaScript 1.77% HTML 1.68% TypeScript 95.43%
comments compilation conditional es6 html javascript jspreproc parser preprocessor replacement typescript

jscc's People

Contributors

amarcruz avatar dasa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

jscc's Issues

Use with imports

Hi

I was trying to do something like:

import thing from '../my-thing.js';

//#set _FOO = thing.object[key]

But am getting `thing is not defined in expression "thing.object[key]".
Is it possible to make this work?

Webpack plugin

Thank you for all your hard work. Any chance of a webpack plugin?

Browserify plugin

This is really cool! Any chance for a browserify plugin? I'd like to use jscc within budo during development which uses browserify under the hood.

Error: Invalid regular expression

Single line directives capture the comment ending token as part of the expression.

/* #if process.env.TARGET === 'chrome' */
Error: Invalid regular expression: missing / in expression "process.env.TARGET === 'chrome' */"

For languages such as css that don't have single line comments this means that directions must be two lines.

/* #if process.env.TARGET === 'chrome'
*/

not work with eslint rule: comma-spacing

eslint will insert spacing after // and /*

// #set _DEBUG = 1           // this is a jscc comment

/* #if _DEBUG                // closing this multiline comment */
    // #if process.env.devmode === 'production'
    // #set _DEBUG 0         // the `=` is optional
    // #else                 anything after `#else` or `#endif` is ignored
/* eslint-disable no-console */
console.log('Debug mode on.');
    // #endif
// #endif _DEBUG             '_DEBUG' is ignored

So, jscc could not work.

what about a more complex "if" ?

I have many of the lines below:

//#if _JSCC__BUNDLE_FOO || _JSCC__BUNDLE_ALL
import foo  from './controllers/foo';
//#endif
//#if _JSCC__BUNDLE_BAR || _JSCC__BUNDLE_ALL
import bar  from './controllers/bar';
//#endif
//#if _JSCC__BUNDLE_BAZ || _JSCC__BUNDLE_ALL
import baz  from './controllers/baz';
//#endif

I use Rollup and I want the user to control if each component should or should be loaded individually or simply allow all of them to be bundled. I saw no mention of this in the WIKI.

Also, why is the //#endif needed? can you make so if it is omitted then only the code line directly below the if is taken into account?

Thanks!

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.