question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to change img reference in css

See original GitHub issue

I want to change:

.demo{
    background: url("../img/demo.jpg");
}

to like:

.demo{
    background: url("../img/demo-0317f424c0.jpg");
}

how can I do this?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
shonny-uacommented, Aug 18, 2017

Use gulp-filter

const filter = require('gulp-filter');
const fHtml = filter(['**/*.html', '*.html', '../**/*.html'], {restore: true});
const fCss = filter(['**/*.css', '*.css', '../**/*.css'], {restore: true});

return gulp.src(['rev/**/*.json', 'src/*.html', 'css/**/*.css'])
    .pipe(revCollector({
      replaceReved: true,
    }))
    .pipe(fHtml)
    .pipe(gulp.dest('dist/html'))
    .pipe(fHtml.restore)
    .pipe(fCss)
    .pipe(gulp.dest('dist/css'))
0reactions
RickCole21commented, Aug 19, 2017

got it ~ thanks alot

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS background-image property - W3Schools
The background-image property sets one or more background images for an element. By default, a background-image is placed at the top-left corner of...
Read more >
background-image - CSS: Cascading Style Sheets | MDN
The background-image CSS property sets one or more background images on an element.
Read more >
How to Add an Image to a CSS File
1. Open your website's stylesheet with your HTML editor or a text editor. · 2. Paste the following code into the sheet to...
Read more >
CSS images: url() · WebPlatform Docs
CSS has a variety of different properties that can reference an image file, displaying that file on a web page normally as part...
Read more >
Replace the Image in an <img> with CSS
Replace the Image in an <img> with CSS · It works on just about any element, even empty ones like <img> or <hr>...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found