Giter Site home page Giter Site logo

Comments (1)

nqdy666 avatar nqdy666 commented on May 27, 2024

在html或者jsp中使用元素行内样式设置图片需要使<div class="banner" style="background-image: url(${require('../../assets/images/common/banner_3.png')})"></div>这种语法,这是HtmlWebpackPlugin默认的ejs语法能够解析的,但是用了raw-loader之后,也就无法处理了

如果不用raw-loader,那么jsp或者ftl(freemarker)也是无法打包成功的,这两个完全冲突了

当然,如果不使用<div class="banner" style="background-image:url(${require('../../assets/images/common/banner_3.png')})"></div>这种语法,是可以不管这个问题的,但是,这种需求还是很强烈的,不知道有什么解决方式?

1、有能力的话,可以自定义loader。以便HtmlWebpackPlugin可以进行支持变量注入。
2、关于你的那一种写法,建议用前端模板处理,比如vue的,应该达到你的要求。

from wjsp.

Related Issues (4)

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.