Skip to content

Commit

Permalink
Merge pull request #382 from meandmax/build-setup-and-fix-jQuery-bug
Browse files Browse the repository at this point in the history
Make development more convient - fix jQuery reference error
  • Loading branch information
meandmax authored Aug 21, 2016
2 parents a2bcf3d + 5b0dd3f commit 1205104
Show file tree
Hide file tree
Showing 39 changed files with 242 additions and 3,635 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ cache:
notifications:
email: false
node_js:
- '4'
- '5.2'
before_install:
- npm i -g npm@^2.0.0
- npm i -g npm@^3.3
before_script:
- npm prune
- 'curl -Lo travis_after_all.py https://git.io/vLSON'
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

<p align="center">
<img src="./demo/lory.png" width="200px" />
<img src="./static/lory.png" width="200px" />
</p>

Please visit: [http://meandmax.github.io/lory/](http://meandmax.github.io/lory/ "lory")
Expand All @@ -27,8 +27,8 @@ Please visit: [http://meandmax.github.io/lory/](http://meandmax.github.io/lory/
lory is released under the MIT license & supports modern environments.
There is also a prebundled CDN version which you can use.

#### Vanilla JavaScript: https://cdn.jsdelivr.net/lory-js/2.1.0/lory.min.js
#### jQuery plugin: https://cdn.jsdelivr.net/lory-js/2.1.0/jquery.lory.min.js
#### Vanilla JavaScript: https://cdn.jsdelivr.net/lory-js/2.1.0/lory.js
#### jQuery plugin: https://cdn.jsdelivr.net/lory-js/2.1.0/jquery.lory.js

## Install with node:

Expand Down Expand Up @@ -79,7 +79,7 @@ npm install
// To start the development server run:
npm start
npm run dev
// To lint your code run:
Expand Down Expand Up @@ -180,7 +180,7 @@ li {
## Integration as a jQuery Plugin

```js
<script src="js/jquery.lory.min.js"></script>
<script src="dist/jquery.lory.js"></script>
<script>
'use strict';

Expand All @@ -195,7 +195,7 @@ li {
## Integration of multiple sliders on one page

```javascript
<script src="js/lory.js"></script>
<script src="dist/lory.js"></script>
<script>
'use strict';

Expand Down
54 changes: 54 additions & 0 deletions bin/compile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import webpack from 'webpack';
import _debug from 'debug';
import fs from 'fs-extra';
import config from '../webpack.config.prod.js';

const debug = _debug('app:build:webpack-compiler');

const DEFAULT_STATS_FORMAT = {
chunks : false,
chunkModules : false,
colors : true
}

function webpackCompiler (webpackConfig, statsFormat = DEFAULT_STATS_FORMAT) {
return new Promise((resolve, reject) => {
const compiler = webpack(webpackConfig);

compiler.run((err, stats) => {
const jsonStats = stats.toJson();

debug('Webpack compile completed.');
debug(stats.toString(statsFormat));

if (err) {
debug('Webpack compiler encountered a fatal error.', err);
return reject(err);
} else if (jsonStats.errors.length > 0) {
debug('Webpack compiler encountered errors.');
debug(jsonStats.errors.join('\n'));
return reject(new Error('Webpack compiler encountered errors'));
} else if (jsonStats.warnings.length > 0) {
debug('Webpack compiler encountered warnings.');
debug(jsonStats.warnings.join('\n'));
} else {
debug('No errors or warnings encountered.');
}
resolve(jsonStats);
});
});
}

;(async function () {
try {
debug('Run compiler');
const stats = await webpackCompiler(config);
if (stats.warnings.length && config.compiler_fail_on_warning) {
debug('Config set to fail on warning, exiting with status code "1".');
process.exit(1);
}
} catch (e) {
debug('Compiler encountered an error.', e);
process.exit(1);
}
})();
11 changes: 11 additions & 0 deletions bin/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import webpack from 'webpack';
import config from '../webpack.config.dev.js';
import WebpackDevServer from 'webpack-dev-server';

config.entry.app.unshift("webpack-dev-server/client?http://localhost:8080/", "webpack/hot/dev-server");
const compiler = webpack(config);
const server = new WebpackDevServer(compiler, {
hot: true
});

server.listen(8080);
86 changes: 0 additions & 86 deletions demo/custom-index.html

This file was deleted.

Loading

0 comments on commit 1205104

Please sign in to comment.