Skip to content

Instantly share code, notes, and snippets.

@JeffreyMFarley
Last active August 1, 2018 22:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeffreyMFarley/7fa514883349329bd25001998db70bb2 to your computer and use it in GitHub Desktop.
Save JeffreyMFarley/7fa514883349329bd25001998db70bb2 to your computer and use it in GitHub Desktop.
2017-10-26 - Grunt to Webpack.md
  1. npm i -D css-loader eslint-loader file-loader less-loader postcss-loader string-replace-loader style-loader url-loader

Include HTML & Images in webpack

  1. //@require "../../**/*.html" => too many errors
  2. //@require "../../**/*.png" => hey look! embedded urls, but are the paths right?
    1. require('../../partial/header.html'); => Can't resolve './static/images/logo.png'
      1. https://www.npmjs.com/package/resolve-url-loader => hrm
      2. change the src tag in header.html => no dice
      3. https://github.com/webpack-contrib/html-loader
      4. publicPath in config? => Nooooooooo
      5. https://stackoverflow.com/questions/32753650/webpack-loading-images-from-html-templates
      6. `<img src="<%=require("../static/images/logo.png")%>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment