Skip to content
This repository has been archived by the owner on Aug 22, 2019. It is now read-only.

Enable Emmet CodeMirror to Work in Webpack/ES6 Environment #20

Merged
merged 1 commit into from
Jul 4, 2016
Merged

Enable Emmet CodeMirror to Work in Webpack/ES6 Environment #20

merged 1 commit into from
Jul 4, 2016

Conversation

quezo
Copy link

@quezo quezo commented Jul 1, 2016

Hi Sergey. I work at CodePen and we just got done integrating Emmet CodeMirror using Webpack/ES6. I wanted to share the changes we needed to make to make it all work.

I was able to properly load Emmet CodeMirror by adding a global reference to the CodeMirror class in the main.setup function. Since we import CodeMirror as a module it isn't available on the window object. I wanted to touch the least amount of code so I stored a reference to the CodeMirror class on window.

I also removed the check that looks for CodeMirror on load.

I then updated the package.json main file to point to emmet-wp.js Last I created a dist action that builds emmet with webpack with the production flag.

@sergeche sergeche merged commit d718dbc into emmetio:webpack Jul 4, 2016
@sergeche
Copy link
Member

sergeche commented Jul 4, 2016

Thanks!
I don}t personally like making a global references so I’ll refactor it a bit. I’ll ping you when I’m done

@sergeche
Copy link
Member

sergeche commented Jul 6, 2016

Hey Alex,
I just updated webpack branch with:

  • no global variable for CodeMirror class
  • more ES6 module compliance
  • use Webpack by default instead of Gulp

Can you check if it works for you as expected?

@quezo
Copy link
Author

quezo commented Jul 11, 2016

@sergeche This works great. I had to make some changes to how we imported Emmet CodeMirror. I created a very simple Gist showing how we import it in case it's any help to the next person.

https://gist.github.com/quezo/994678f74bac733198d651849402fc20

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants