Resolve "Replace Gulp with Webpack"

This commit is contained in:
sonny 2020-03-25 22:24:32 +01:00
parent 16230a11f3
commit b28d42b97b
18 changed files with 1673 additions and 1863 deletions

View file

@ -3,8 +3,11 @@ import ReactDOM from 'react-dom';
import App from './App.js';
const content = document.getElementById('categories--page');
const dataScript = document.getElementById('categories-data');
const categories = JSON.parse(dataScript.textContent);
const page = document.getElementById('categories--page');
ReactDOM.render(<App categories={categories} />, content);
if (page) {
const dataScript = document.getElementById('categories-data');
const categories = JSON.parse(dataScript.textContent);
ReactDOM.render(<App categories={categories} />, page);
}

View file

@ -51,7 +51,7 @@ class PostModal extends React.Component {
className="button post__close-button"
onClick={() => this.props.unSelectPost()}
>
Close <i class="gg-close"></i>
Close <i className="gg-close"></i>
</button>
<div className="post__header">
<h1 className={titleClassName}>{`${post.title} `}</h1>

View file

@ -52,7 +52,7 @@ class FeedList extends React.Component {
return (
<div className="post-message">
<div className="post-message__block">
<i class="gg-arrow-left" />
<i className="gg-arrow-left" />
<p className="post-message__text">Select an item to show its unread posts</p>
</div>
</div>

View file

@ -6,12 +6,15 @@ import configureStore from './configureStore.js';
import App from './App.js';
const content = document.getElementById('homepage--page');
const store = configureStore();
const page = document.getElementById('homepage--page');
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
content
);
if (page) {
const store = configureStore();
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
page
);
}

View file

@ -3,8 +3,11 @@ import ReactDOM from 'react-dom';
import App from './App.js';
const content = document.getElementById('rules--page');
const dataScript = document.getElementById('rules-data');
const rules = JSON.parse(dataScript.textContent);
const page = document.getElementById('rules--page');
ReactDOM.render(<App rules={rules} />, content);
if (page) {
const dataScript = document.getElementById('rules-data');
const rules = JSON.parse(dataScript.textContent);
ReactDOM.render(<App rules={rules} />, page);
}

View file

@ -25,5 +25,6 @@
{% endfor %}
]
</script>
<script src="{% static 'js/rules.js' %}"></script>
{{ block.super }}
{% endblock %}

View file

@ -30,5 +30,6 @@
{% endfor %}
]
</script>
<script src="{% static 'js/categories.js' %}"></script>
{{ block.super }}
{% endblock %}

View file

@ -5,7 +5,3 @@
{% block content %}
<main id="homepage--page" class="main"></main>
{% endblock %}
{% block scripts %}
<script src="{% static 'js/homepage.js' %}"></script>
{% endblock %}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -4,6 +4,7 @@
<html>
<head>
<title>Newreader</title>
<link type="image/png" href="{% static 'icons/rss.png' %}" rel="shortcut icon" />
{% block head %}
<link href="{% static 'css/main.css' %}" rel="stylesheet" />
{% endblock %}
@ -38,5 +39,7 @@
{% block content %}{% endblock content %}
</body>
{% block scripts %}{% endblock %}
{% block scripts %}
<script src="{% static 'js/main.bundle.js' %}"></script>
{% endblock %}
</html>