progress on migrating to heex templates and font-icons

This commit is contained in:
Adam Piontek 2022-08-13 07:32:36 -04:00
commit 3eff955672
21793 changed files with 2161968 additions and 16895 deletions
assets_old/node_modules/svg-sprite-loader/examples/custom-runtime-generator-extract-mode

View file

@ -0,0 +1,97 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "build/";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__assets_twitter_svg__ = __webpack_require__(1);
// => {width: string, height: string, viewBox: string, url: string}
console.log(__WEBPACK_IMPORTED_MODULE_0__assets_twitter_svg__["a" /* default */]);
window.addEventListener('DOMContentLoaded', () => {
const image = `<img src="${__WEBPACK_IMPORTED_MODULE_0__assets_twitter_svg__["a" /* default */].url}" width="${__WEBPACK_IMPORTED_MODULE_0__assets_twitter_svg__["a" /* default */].width}" height="${__WEBPACK_IMPORTED_MODULE_0__assets_twitter_svg__["a" /* default */].height}">`;
document.body.innerHTML = image;
});
/***/ }),
/* 1 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony default export */ __webpack_exports__["a"] = ({
"width": 273,
"height": 222,
"viewBox": "0 0 273.4 222.2",
"url": "build/sprite.svg#twitter-usage"
});
/***/ })
/******/ ]);

View file

@ -0,0 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style>
.sprite-symbol-usage {display: none;}
.sprite-symbol-usage:target {display: inline;}
</style><symbol viewBox="0 0 273.4 222.2" id="twitter">
<path d="M273.4,26.3c-10.1,4.5-20.9,7.5-32.2,8.8c11.6-6.9,20.5-17.9,24.7-31C255,10.5,243,15.2,230.2,17.7
C220,6.8,205.4,0,189.3,0c-31,0-56.1,25.1-56.1,56.1c0,4.4,0.5,8.7,1.5,12.8C88,66.5,46.7,44.2,19,10.3c-4.8,8.3-7.6,17.9-7.6,28.2
c0,19.5,9.9,36.6,25,46.7c-9.2-0.3-17.8-2.8-25.4-7c0,0.2,0,0.5,0,0.7c0,27.2,19.3,49.8,45,55c-4.7,1.3-9.7,2-14.8,2
c-3.6,0-7.1-0.4-10.6-1c7.1,22.3,27.9,38.5,52.4,39c-19.2,15-43.4,24-69.7,24c-4.5,0-9-0.3-13.4-0.8c24.8,15.9,54.3,25.2,86,25.2
c103.2,0,159.6-85.5,159.6-159.6c0-2.4-0.1-4.9-0.2-7.3C256.4,47.4,265.9,37.5,273.4,26.3z" />
</symbol></defs><use id="twitter-usage" xlink:href="#twitter" class="sprite-symbol-usage" /></svg>

After

(image error) Size: 912 B

View file

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="build/main.js"></script>
</head>
<body>
</body>
</html>

View file

@ -0,0 +1,19 @@
const { generateSpritePlaceholder, stringify } = require('../../lib/utils');
module.exports = function runtimeGenerator({ symbol, loaderContext }) {
// this will be replaced with real symbol url, e.g. sprite.svg#twitter-usage
const publicPath = loaderContext._compiler.options.output.publicPath;
const spritePlaceholder = generateSpritePlaceholder(symbol.request.file);
const viewBoxParts = symbol.viewBox.split(' ');
const width = parseInt(viewBoxParts[2], 10);
const height = parseInt(viewBoxParts[3], 10);
const data = {
width,
height,
viewBox: symbol.viewBox,
url: publicPath + spritePlaceholder
};
return `export default ${stringify(data)}`;
};

View file

@ -0,0 +1,9 @@
import symbolData from '../assets/twitter.svg';
// => {width: string, height: string, viewBox: string, url: string}
console.log(symbolData);
window.addEventListener('DOMContentLoaded', () => {
const image = `<img src="${symbolData.url}" width="${symbolData.width}" height="${symbolData.height}">`;
document.body.innerHTML = image;
});

View file

@ -0,0 +1,33 @@
const path = require('path');
const merge = require('deepmerge');
const baseConfig = require('../base-webpack.config');
const SpritePlugin = require('../../plugin');
const config = merge(baseConfig, {
context: __dirname,
entry: './main',
output: {
path: path.resolve(__dirname, 'build'),
publicPath: 'build/'
},
module: {
rules: [
{
test: /\.svg$/,
loader: 'svg-sprite-loader',
options: {
extract: true,
runtimeGenerator: require.resolve('./extracting-runtime-generator.js')
}
}
]
},
plugins: [
new SpritePlugin()
]
});
module.exports = config;