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

Fix quotes #1098

Merged
merged 2 commits into from
Sep 18, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 4 additions & 8 deletions lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,13 @@ function Server(compiler, options) {

app.get('/webpack-dev-server', (req, res) => {
res.setHeader('Content-Type', 'text/html');
/* eslint-disable quotes */
res.write('<!DOCTYPE html><html><head><meta charset="utf-8"/></head><body>');
const outputPath = this.middleware.getFilenameFromUrl(options.publicPath || "/");
const outputPath = this.middleware.getFilenameFromUrl(options.publicPath || '/');
const filesystem = this.middleware.fileSystem;

function writeDirectory(baseUrl, basePath) {
const content = filesystem.readdirSync(basePath);
res.write("<ul>");
res.write('<ul>');
content.forEach((item) => {
const p = `${basePath}/${item}`;
if (filesystem.statSync(p).isFile()) {
Expand Down Expand Up @@ -139,9 +138,8 @@ function Server(compiler, options) {
res.write('</li>');
}
});
res.write("</ul>");
res.write('</ul>');
}
/* eslint-enable quotes */
writeDirectory(options.publicPath || '/', outputPath);
res.end('</body></html>');
});
Expand Down Expand Up @@ -624,13 +622,11 @@ Server.prototype.serveMagicHtml = function (req, res, next) {
try {
if (!this.middleware.fileSystem.statSync(this.middleware.getFilenameFromUrl(`${_path}.js`)).isFile()) { return next(); }
// Serve a page that executes the javascript
/* eslint-disable quotes */
res.write('<!DOCTYPE html><html><head><meta charset="utf-8"/></head><body><script type="text/javascript" charset="utf-8" src="');
res.write(_path);
res.write('.js');
res.write(req._parsedUrl.search || "");
res.write(req._parsedUrl.search || '');
res.end('"></script></body></html>');
/* eslint-enable quotes */
} catch (e) {
return next();
}
Expand Down