Rocketact

Rocketact

  • Docs
  • GitHub

›Development

Getting Started

  • Getting Started
  • Folder Structure
  • Available Scripts
  • Supported Browsers and Features
  • Custom Templates

Development

  • Managing Dependencies
  • Adding Pages
  • Adding Stylesheets
  • Post-Processing CSS
  • Adding Images
  • Http proxy

Deployment

  • Public Path

Plugins

  • What is the plugin?
  • rocketact-plugin-polyfill
  • rocketact-plugin-bundle-analyzer
  • Plugin template
  • Awesome Plugins
Edit

Adding Images

Reference Images in Components

In components, you can import images just like importing another JavaScript module. Once imported, you can use the imported value as the src prop of an image.

Here is an example:

import * as React from 'react';
import * as ReactDOM from 'react-dom';

import logo from './rocketact.png';

ReactDOM.render(
  <div className="App">
    <header className="App-header">
      <img src={logo} />
    </header>
  </div>,
  document.getElementById('app')
);

By referencing images this way, Webpack will include the image in the final bundles and will handle publicPath and hashes properly.

Reference Images in CSS

Nothing special here, just reference the image through relative paths and Webpack will replace theme with final paths.

.logo {
  background: url(./rocketact.png);
}
Last updated on 3/25/2019 by loveky
← Post-Processing CSSHttp proxy →
  • Reference Images in Components
  • Reference Images in CSS
Rocketact
Docs
Getting Started
Community
User ShowcaseIssues
More
GitHubStar
Copyright © 2018-present Rocketact documentation authors.