1.2.8 • Published 5 years ago

atma-io-middleware-condcomments v1.2.8

Weekly downloads
6
License
MIT
Repository
-
Last release
5 years ago

Conditional comments file middleware for Atma.IO and Atma.Toolkit. Supports JavaScript and HTML comments.

The Plugin provides a custom middleware to exclude/include conditional comments:

How to use
Extend files

There are 2 strategies: to comment and to uncomment. You should use to comment strategy for default block, so that a file is valid even without a condcomment middleware.

  • Uncomment on TRUE expressions

    /*#if (EXPRESSION)
        content body
    */
  • Comment on FALSE expressions

    //#if (EXPRESSION)
    content body
    //#endif
Expressions

Expressions are usual javascript expressions. The values for variables are taken from a) ENV and b) process argv c) middleware settings.

Embed into the project
  • Atma Toolkit

    $ atma plugin install atma-io-middleware-condcomments --save-dev
    	This adds `atma-io-middleware-condcomments` npm dependency and the `package.json` would look like:
        {
            "devDependencies": {
                "atma-io-middleware-condcomments"
            },
            "atma": {
                "plugins": [
                    "atma-io-middleware-condcomments"
                ],
                "settings": {
    						"atma-io-middleware-condcomments": {
                        "defines": {
                            "DEBUG": true
                        }
                    },
                    "io": {
                        "extensions": {
                            "ts": [
                                "atma-io-middleware-condcomments:read",
                                "atma-loader-ts:read"
                            ]
                        }
                    }
    
                }
            }
        }
  • App Bundler

    $ npm i atma-io-middleware-condcomments --save-dev

    Extend AppBundler config with IO settings, for example in package.json for typescript extensions.

    {
        /* ... any package json settings */
        "app-bundler": {
            /* ... any app-bundler settings */
            "middlewares": {                
                "ts": [
                    "atma-io-middleware-condcomments:read",
                    "atma-loader-ts:read"
                ]
            }
        },
    }
  • Run

    • Atma Toolkit Dev Server

      $ atma server
    • App Bundler Just run app bundler commands as usual


The MIT License

1.2.8

5 years ago

1.2.7

5 years ago

1.2.6

6 years ago

1.2.5

6 years ago

1.2.3

6 years ago

1.2.1

6 years ago

1.1.27

6 years ago

1.1.26

6 years ago

1.1.25

6 years ago