Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
matgr1 committed Oct 19, 2016
1 parent ace2667 commit 2134265
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 29 deletions.
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
# glsl-simple-include

NOTE: es5 version requires babel-polyfill
Preprocessor for a simple "#pragma include" directive.

```bash
npm install glsl-simple-include --save
```

```glsl
#pragma include "/path/to/file.glsl"
```

```javascript
var GlslSimpleInclude = require('read-text-file');
var readTextFile = require('read-text-file');
var path = require('path');

var processPromise = GlslSimpleInclude.processIncludes(
readTextFile.read,
path,
"/path/to/file.glsl",
null);
```
10 changes: 3 additions & 7 deletions build/es5/glsl-simple-include.js

Large diffs are not rendered by default.

10 changes: 3 additions & 7 deletions build/es6/glsl-simple-include.js

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "glsl-simple-include",
"version": "0.0.6-alpha.6",
"description": "Preprocessor for a simple \"#pragma include\" directive in shader files",
"version": "1.0.0",
"keywords": [
"glsl"
],
Expand All @@ -23,8 +22,7 @@
"typescript": "2.0.3"
},
"dependencies": {
"babel-runtime": "^6.11.6",
"strip-bom": "^3.0.0"
"babel-runtime": "^6.11.6"
},
"babel": {
"presets": [
Expand Down
12 changes: 2 additions & 10 deletions src/glsl-simple-include.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
declare let require: any;
let stripBom = require("strip-bom");

export type readScript = (path: string) => Promise<string>;

export interface path
Expand Down Expand Up @@ -29,7 +26,7 @@ export async function processIncludes(
}
else
{
entryScript = fixScript(entryScript);
entryScript = fixLineEndings(entryScript);
}

return await processScript(
Expand Down Expand Up @@ -229,12 +226,7 @@ async function getScriptIncludes(
async function readShaderScript(path: string, readScript: readScript): Promise<string>
{
let script = await readScript(path);
return fixScript(script);
}

function fixScript(source: string)
{
return fixLineEndings(stripBom(source));
return fixLineEndings(script);
}

function fixLineEndings(source: string)
Expand Down

0 comments on commit 2134265

Please sign in to comment.