Git Product home page Git Product logo

Comments (4)

zgjimgjonbalaj avatar zgjimgjonbalaj commented on May 23, 2024

Just realized the loader expects no leading slash in the src attribute ie

Bad: "/images/img-name.jpg"
Good "images/img-name.jpg"

I think it makes sense to add a wildcard there, many of us are used to relative URLs

from static-site-boilerplate.

zgjimgjonbalaj avatar zgjimgjonbalaj commented on May 23, 2024

Likewise in SCSS

Bad: "/images/img-name.jpg"
Good: "../images/img-name.jpg"

from static-site-boilerplate.

joannaong avatar joannaong commented on May 23, 2024

Images loaded via style and data attributes does not load in prod build

For example, images here is not rendered in prod build

<div style="background-image: url(images/slide-3d.jpg)">
<section data-image-src="images/bg-welcome.jpg">

from static-site-boilerplate.

ericalli avatar ericalli commented on May 23, 2024

When using images in your HTML, use the require syntax. The interpolate feature of html-loader will take care of copying over whatever you require into the dist/ folder.

// Require images like so
${require('./images/photo.jpg')}

// Here's an example in your HTML
<div style="background-image: url(${require('./images/photo.jpg')})">

from static-site-boilerplate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.