Skip to content

Add content for "how to develop" #231

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

Merged
merged 3 commits into from
Oct 11, 2016
Merged

Conversation

SpaceK33z
Copy link
Member

This is my first try at the "How to develop" page.

According to the stubs I made earlier, I should also include how to use the Node.js API for the watch mode and dev-server. On second thought, this should really be a separate page. For beginners this will be even more confusing. We already teach them 3 ways to develop, with the API variants that would essentially mean 5 ways.

I'm curious to your feedback!


- Explain that some editors use "atomic save"; this needs to be disabled in order to see all file changes.
In most cases **you'll want to use webpack-dev-server**.
Copy link
Contributor

Choose a reason for hiding this comment

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

Add why.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

- show how to use in CLI
- show how to use API
- explain that you need to use your own server (maybe show the python server)
### Adjusting Your Text Editor
Copy link
Contributor

Choose a reason for hiding this comment

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

Just ##, check the headers.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.


### Source Maps

When a Javascript exception occurs, you'll often want to know what file and line is generating this error. Since webpack outputs files into one or more bundles, it can be inconvenient to trace the file.
Copy link
Contributor

Choose a reason for hiding this comment

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

/s/Javascript/JavaScript - check overall.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.


### Source Maps
Copy link
Contributor

Choose a reason for hiding this comment

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

This is in a weird place and breaks the flow a bit. Maybe you could mention about the topic at a tip (T>). Not sure.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, I kinda agree with you here, but the meaning of this document was to explain what you need to get started with developing. I find it a bit weird to put this into a tip since it's such an essential part.

I could try a more step based approach. That would be:

## 1. Adjusting Your Text Editor
## 2. Source Maps
## 3. Choosing a Tool
### webpack Watch Mode
### webpack-dev-server
### webpack-dev-middleware

This would also allow us to add more steps. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds better. Or push the sourcemap bit to an article of its own and link there.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I already link to the sourcemap article for more information, but I want to explain it in short here :).

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, ok then.


webpack's watch mode watches files for changes. If any change is detected, it'll run the compilation again.

We want webpack to display nice colors and a progress bar while it's compiling. Let's run the command:
Copy link
Contributor

Choose a reason for hiding this comment

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

If I remember right, --colors shouldn't be needed anymore. webpack should be able to detect color support automatically. The flag might not exist. Check this.

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right. Fixed.

python -m SimpleHTTPServer
```

After each compilation, you will need to manually refresh your browser to see the changes.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe mention about a Node based alternative too. I use serve myself though there are lots of options.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.


Make a change in one of your files and hit save. You should see that it's recompiling.

Watch mode makes no assumptions about a server, so you will need to provide your own. The most easy way to start a HTTP server is with:
Copy link
Contributor

Choose a reason for hiding this comment

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

The most easy -> The easiest

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.


### webpack-dev-server

webpack-dev-server provides you with a server and live reloading. This is relatively easy to setup.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would scratch "relatively" as it doesn't add value.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@SpaceK33z
Copy link
Member Author

@bebraw, all your feedback is implemented. I refactored the headings to be more step-by-step.

@bebraw bebraw merged commit f8fedc2 into webpack:develop Oct 11, 2016
@SpaceK33z SpaceK33z deleted the how-to-develop branch October 11, 2016 12:21
sallar pushed a commit to sallar/webpack.js.org that referenced this pull request Oct 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants