Skip to content

Commit

Permalink
Added some personal notes
Browse files Browse the repository at this point in the history
  • Loading branch information
chasevida committed Jan 6, 2018
1 parent 61ee12a commit bf15b39
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@



Ok, so this was slightly confusing. Setting up [glslify](https://github.com/glslify/glslify) with [webpack](https://webpack.js.org/) can be a little tricky and depending on your setup there can be some unexpected quirks - at least there was for me. While trying to get glslify to play nicely with my webpack config I ran into several issues and depending on your setup they seem to flip around. So, to get a handle on how to get this all working correctly I stripped everything right back to a bare bones setup and tried a couple of suggested webpack loaders and babel plugins, some of which appear to be out of date and awaiting [fixes](https://github.com/glslify/babel-plugin-glslify/pull/9.). Overall the process hasn't been exactly smooth or encouraging so hopefully this repo helps out the next person who finds themselves struggling.
Ok, so this was slightly confusing. Setting up [glslify](https://github.com/glslify/glslify) with [webpack](https://webpack.js.org/) can be a little tricky and depending on your setup there can be some unexpected quirks - at least there was for me.



While trying to get glslify to play nicely with my webpack config I ran into several issues and depending on your setup they seem to flip around. So, to get a handle on how to get this all working correctly I stripped everything right back to a bare bones setup and tried a couple of suggested webpack loaders and babel plugins, some of which appear to be out of date and awaiting [fixes](https://github.com/glslify/babel-plugin-glslify/pull/9.).



Overall the process hasn't been exactly smooth or encouraging so hopefully this repo helps out the next person who finds themselves struggling.



Expand Down Expand Up @@ -52,6 +60,14 @@ In summary the `ify-loader` is definitely the best choice. However, if you are u



I think what's thrown me, at least while getting started, is how the method `glslify` behaves differently with each approach. As you can see in some scenarios it will compile fine when passed an imported shader string but in others it will throw an error and in other cases it will compile but silently ignore pragma imports. This probably makes sense once you've been working with it for a while but when I tried loading some of these approaches into an existing webpack setup I quickly became confused as to which approach was semantically right even after reading the docs. It's also worth mentioning that I am exteremly tired with a newborn and that I may just be missing the obvious here.



Anyways, I'm super keen to start using [stack.gl](http://stack.gl) within some existing projects so this will help serve as a reminder of what works going forward. If you know more about this than me, please please drop me a line in an issue here to help clear things up - cheers.



## Install & Run

If you have [Nodejs](https://nodejs.org/en/) > 8.9 and [Yarn](https://yarnpkg.com/en/) installed you can use the following:
Expand Down
2 changes: 1 addition & 1 deletion test-glslify-loader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ The compositions under test here are:

Calling ```glslify`` ```compiles with webpack but does not include and compile any required shader pragma imports. While compiling with webpack no errors are thrown but when viewed in the browser you can see that no additional shaders are transformed.

### 2 File
### 2. File

Calling `glslify('./glsl/basic.vert')` fails silently. While it compiles with webpack (without errors) you can see when running it in the browser that the file was not required/imported and transformed.

0 comments on commit bf15b39

Please sign in to comment.