Comments (1)
在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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wjsp.