Giter VIP home page Giter VIP logo

clopp's Issues

Multiple else cases don't work in Html

For example:

    <!-- #if __chrome
    <script id="booster-api" type="text/javascript" src="../../shared/booster/api.js"></script>
    <!-- #elseif __target='dev'  -->
    <script id="booster-api" type="text/javascript" src="shared/booster/api.js"></script>
    <!-- #endelseif
    <!-- #elseif __target='prod' || __target='stage'
    <script id="booster-api" type="text/javascript" src="/shared/booster/api.js"></script>
    <!-- #endeif -->

Defined variables at the very end of files don't get replaced by clopp

Say you have this piece of code:

/* #define myDefinition "someString" */

// your code here

myDefinition

Your myDefinition variable at the end of the file won't be replaced by it's value, "someString", because it is at the very end of the file.

Until anybody finds a valid use case for this, I am not really feeling like fixing this... mostly because it is a pain in the ass to fix :)

Doesn't handle .ts files

clopp should handle .ts files "out of the box", which is trivial to do, because it is so like .js. However, a way to configure how to process a new file type would be more generic, and highly useful. Perhaps regular expressions to recognize comments, or some such.

#includes are not fully preprocessed

Currently, #includes do not work 100% correctly. They work only "only layer deep".

For example, evaluate this code:

main.js

/* Some random code */

// #include fileA.js

/* Some more random code */

fileA.js

/* Some random code */

// #include fileB.js

// #exclude
/* random code */
// #endexclude

// #if 1+1==2
// Well look at that! 1+1 equals 2!
// #endif

/* Some more random code */

fileB.js

/* Some more random code */

The result of main.js will be this when the preprocessor is completely done with your files:

/* Some random code */

/* Some random code */

// #include fileB.js

// #exclude
/* random code */
// #endexclude

// Well look at that! 1+1 equals 2!

/* Some more random code */

/* Some more random code */

The reason for this is that includes & excludes do not get preprocessed in files that have been #included. All other preprocessor tags (#define, #ifdef, #ifndef, #if, etc) do get preprocessed.

Nested ifs in html don't operate as expected

For example:

    <!-- #if __chrome
        <script id="booster-api" type="text/javascript" src="../../shared/booster/api.js"></script>
    <!-- #else  -->
        <!-- #if __target='dev' -->
            <script id="booster-api" type="text/javascript" src="shared/booster/api.js"></script>
        <!-- #else
            <script id="booster-api" type="text/javascript" src="/shared/booster/api.js"></script>
        <!-- #endif -->
    <!-- #endif -->

Wont replace a variable followed by a semicolon

For example this statement is not correctly handled:

var foo = SOMECONFIGPARAM;

where SOMECONFIGPARAM is defined in the context, it will fail to be replaced.

Fix is simple add a semicolon to the expression on line 316:

contents = contents.replace(new RegExp('([ \+\-\\!\|\[\]\'\"\>\<\=\(\)\n\t])(' + prop + ')([ \'\[\]\+\-\(\)\=\\&\>\<\{\};\n\t!])', 'gi'), function (match, pre, include, post) {

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.