Skip to content

Instantly share code, notes, and snippets.

View karlfloersch's full-sized avatar
🐹
dogeeeeee

Karl Floersch karlfloersch

🐹
dogeeeeee
View GitHub Profile
@karlfloersch
karlfloersch / wrapAsFn.js
Last active March 16, 2016 21:00
Webpack loader that wraps a JS file in a function so that you can inject variables to be modified. Original Author: @IngwiePhoenix
var loaderUtils = require("loader-utils"); // https://www.npmjs.com/package/loader-utils
module.exports = function WrapAsFnLoader(source) {
var query = loaderUtils.parseQuery(this.query);
var exportVars = query.exports;
var exStmt = [];
// Build the local variables by using the exports property on the query.
// This allows us to turn a couple this-variables into locals.
// Use a string to indicate that you want to import it as the same name,
// alternatively, provide an array of key-value pairs: The key becomes the local var,
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="http://openlayers.org/en/v3.5.0/css/ol.css" type="text/css">
<style>
.map {
height: 400px;
width: 100%;
}
</style>