glslify-fancy-imports
glslify transform that provides you with a cleaner module import/export syntax ✨
Last updated 5 years ago by hughsk .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install glslify-fancy-imports 
SYNC missed versions from official npm registry.

glslify-fancy-imports

experimental

glslify transform that provides you with a cleaner module import/export syntax ✨

May eventually be available in glslify directly, but using this for people to try out and express opinions. Regardless, the old syntax will still be available for backwards compatibility.

Setup

NPM

After installing, you can include this as a local transform from the CLI like to enable:

glslify index.glsl -t glslify-fancy-imports

Alternatively you can add the transform by adding glslify.transform to your package.json file:

{
  "name": "my-package",
  "dependencies": {
    "glslify": "^4.0.0",
    "glslify-fancy-imports": "^1.0.0"
  },
  "glslify": {
    "transform": [
      "glslify-fancy-imports"
    ]
  }
}

Usage

Right now the fancy import syntax is just sugar on top of the existing syntax, e.g. the following:

import z from './test'
import y from './test' where { map1 = source2, map2 = source1 }
import x from './test' where {
  map1 = source1,
  map2 = source2
}

export w

Gets converted into:

#pragma glslify: z = require('./test')
#pragma glslify: y = require('./test', map1 = source2, map2 = source1)
#pragma glslify: x = require('./test', map1 = source1, map2 = source2)

#pragma glslify: export(w)

The key difference is that there's no more #pragma glslify:. The imports/exports have their own glslify-specific language syntax (for better, or for worse).

You'll also notice that you can now declare your module name mappings over multiple lines, which is handy for packages that require a lot of configuration this way.

Contributing

See stackgl/contributing for details.

License

MIT. See LICENSE.md for details.

Current Tags

  • 1.0.1                                ...           latest (5 years ago)

2 Versions

  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Downloads
Today 0
This Week 2
This Month 5
Last Day 0
Last Week 0
Last Month 1
Dependencies (2)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |