• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
2
3Permission is hereby granted, free of charge, to any person obtaining a copy
4of this software and associated documentation files (the "Software"), to deal
5in the Software without restriction, including without limitation the rights
6to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7copies of the Software, and to permit persons to whom the Software is
8furnished to do so, subject to the following conditions:
9
10The above copyright notice and this permission notice shall be included in
11all copies or substantial portions of the Software.
12
13THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19THE SOFTWARE. */
20
21var fs = require('fs');
22var webpack = require('webpack');
23
24var entryFile = './src/gl-matrix.js';
25
26// Read the comments from the top of the main gl-matrix file and append them to
27// the minified version.
28var header = '';
29var mainFile = fs.readFileSync(entryFile, { encoding: 'utf8' });
30if (mainFile) {
31  var headerIndex = mainFile.indexOf('\/\/ END HEADER');
32  if (headerIndex >= 0) {
33    header = mainFile.substr(0, headerIndex);
34  }
35}
36
37module.exports = {
38  entry: entryFile,
39  output: {
40    path: __dirname + '/dist',
41    filename: 'gl-matrix.js',
42    libraryTarget: 'umd'
43  },
44  plugins: [
45    new webpack.BannerPlugin(header, { raw: true }),
46  ]
47};