Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading Images #1514

Merged
merged 1 commit into from
Aug 24, 2017
Merged

Loading Images #1514

merged 1 commit into from
Aug 24, 2017

Conversation

srsandy
Copy link
Contributor

@srsandy srsandy commented Aug 13, 2017

Respected Sir,

import _ from 'lodash';
import './style.css';
import Icon from './icon.png';

function component() {
var element = document.createElement('div');
// Lodash, now imported by this script
element.innerHTML = _.join(['Hello', 'webpack'], ' ');
element.classList.add('hello');

  • // Add the image to our existing div.

  • var myIcon = new Image();

  • myIcon.src = Icon;

  • element.appendChild(myIcon);

    return element;
    }

document.body.appendChild(component());

Here in the above code. We are appending a new child which adds the image after 'Hello webpack' not behind it

@jsf-clabot
Copy link

jsf-clabot commented Aug 13, 2017

CLA assistant check
All committers have signed the CLA.

@srsandy
Copy link
Contributor Author

srsandy commented Aug 13, 2017

Sir this is a documentation error

@skipjack skipjack requested a review from TheDutchCoder August 13, 2017 17:53
@skipjack
Copy link
Collaborator

skipjack commented Aug 13, 2017

Respected Sir,
...
Sir this is a documentation error

😆 thanks for the polite greeting with your PR! We're a bit more informal here so no need for "sir" (unless you insist). I requested a review from @TheDutchCoder whose done a lot of work on the guides and should be able to help. Re the error, you are correct -- this was caused by a plugin name change in webpack-contrib -- please ignore and I will resolve in a separate PR.

Copy link
Collaborator

@TheDutchCoder TheDutchCoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, it's probably semantics but I'm okay with it ;)

Respected Sir,

import _ from 'lodash';
  import './style.css';
  import Icon from './icon.png';

  function component() {
    var element = document.createElement('div');
    // Lodash, now imported by this script
    element.innerHTML = _.join(['Hello', 'webpack'], ' ');
    element.classList.add('hello');
+   // Add the image to our existing div.
+   var myIcon = new Image();
+   myIcon.src = Icon;
+   element.appendChild(myIcon);

    return element;
  }

  document.body.appendChild(component());

Here in the above code. We are appending a new child <img> which adds the image after 'Hello webpack' not behind it
@skipjack skipjack merged commit ac8cf3d into webpack:master Aug 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants