0.2.3 #99
48 changed files with 48 additions and 39 deletions
34
gulp/sass.js
34
gulp/sass.js
|
|
@ -1,25 +1,33 @@
|
|||
import { src, dest } from 'gulp';
|
||||
import { dest, series, src } from 'gulp';
|
||||
|
||||
import concat from 'gulp-concat';
|
||||
import path from 'path';
|
||||
import sass from 'gulp-sass';
|
||||
|
||||
const PROJECT_DIR = path.join('src', 'newsreader');
|
||||
const STATIC_DIR = path.join(PROJECT_DIR, 'scss');
|
||||
const SRC_DIR = path.join(PROJECT_DIR, 'scss');
|
||||
const STATIC_SUFFIX = 'dist/css/';
|
||||
|
||||
export const ACCOUNTS_DIR = path.join(PROJECT_DIR, 'accounts', 'static');
|
||||
export const CORE_DIR = path.join(PROJECT_DIR, 'news', 'core', 'static');
|
||||
export const ACCOUNTS_DIR = path.join(PROJECT_DIR, 'accounts', 'static', 'accounts');
|
||||
export const CORE_DIR = path.join(PROJECT_DIR, 'news', 'core', 'static', 'core');
|
||||
|
||||
export const accountsTask = () => {
|
||||
return src(`${STATIC_DIR}/accounts/index.scss`)
|
||||
const taskMappings = [
|
||||
{ name: 'login', destDir: `${ACCOUNTS_DIR}/${STATIC_SUFFIX}` },
|
||||
{ name: 'homepage', destDir: `${CORE_DIR}/${STATIC_SUFFIX}` },
|
||||
];
|
||||
|
||||
export const sassTask = done => {
|
||||
const tasks = taskMappings.map(taskMapping => {
|
||||
const name = taskMapping.name;
|
||||
const destDir = taskMapping.destDir;
|
||||
|
||||
return () => {
|
||||
return src(`${SRC_DIR}/pages/${name}/index.scss`)
|
||||
.pipe(sass().on('error', sass.logError))
|
||||
.pipe(concat('accounts.css'))
|
||||
.pipe(dest(`${ACCOUNTS_DIR}/accounts/dist/css`));
|
||||
.pipe(concat(`${name}.css`))
|
||||
.pipe(dest(destDir));
|
||||
};
|
||||
});
|
||||
|
||||
export const coreTask = () => {
|
||||
return src(`${STATIC_DIR}/homepage/index.scss`)
|
||||
.pipe(sass().on('error', sass.logError))
|
||||
.pipe(concat('core.css'))
|
||||
.pipe(dest(`${CORE_DIR}/core/dist/css`));
|
||||
series(...tasks)(done);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,11 +3,10 @@ import { parallel, series, watch as _watch } from 'gulp';
|
|||
import path from 'path';
|
||||
import del from 'del';
|
||||
|
||||
import { ACCOUNTS_DIR, CORE_DIR, accountsTask, coreTask } from './gulp/sass';
|
||||
import { ACCOUNTS_DIR, CORE_DIR, sassTask } from './gulp/sass';
|
||||
import babelTask from './gulp/babel';
|
||||
|
||||
const PROJECT_DIR = path.join('src', 'newsreader');
|
||||
const sassTasks = [accountsTask, coreTask];
|
||||
|
||||
const clean = () => {
|
||||
return del([
|
||||
|
|
@ -20,8 +19,8 @@ const clean = () => {
|
|||
|
||||
export const watch = () => {
|
||||
return _watch([`${PROJECT_DIR}/scss/**/*.scss`, `${PROJECT_DIR}/js/**/*.js`], done => {
|
||||
series(clean, ...sassTasks, babelTask)(done);
|
||||
series(clean, sassTask, babelTask)(done);
|
||||
});
|
||||
};
|
||||
|
||||
export default series(clean, ...sassTasks, babelTask);
|
||||
export default series(clean, sassTask, babelTask);
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class User(AbstractUser):
|
|||
every=1, period=IntervalSchedule.HOURS
|
||||
)
|
||||
|
||||
self.task = PeriodicTask.objects.create(
|
||||
self.task, _ = PeriodicTask.objects.get_or_create(
|
||||
enabled=True,
|
||||
interval=self.task_interval,
|
||||
name=f"{self.email}-collection-task",
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
{% load static %}
|
||||
|
||||
{% block head %}
|
||||
<link href="{% static 'accounts/dist/css/accounts.css' %}" rel="stylesheet" />
|
||||
<link href="{% static 'accounts/dist/css/login.css' %}" rel="stylesheet" />
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ from newsreader.news.core.endpoints import (
|
|||
NestedPostCategoryView,
|
||||
NestedRuleCategoryView,
|
||||
)
|
||||
from newsreader.news.core.views import MainView
|
||||
from newsreader.news.core.views import NewsView
|
||||
|
||||
|
||||
index_page = login_required(MainView.as_view())
|
||||
index_page = login_required(NewsView.as_view())
|
||||
|
||||
endpoints = [
|
||||
path("posts/", ListPostView.as_view(), name="posts-list"),
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ from typing import Dict
|
|||
from django.views.generic.base import TemplateView
|
||||
|
||||
|
||||
class MainView(TemplateView):
|
||||
template_name = "core/main.html"
|
||||
class NewsView(TemplateView):
|
||||
template_name = "core/homepage.html"
|
||||
|
||||
# TODO serialize objects to show filled main page
|
||||
def get_context_data(self, **kwargs) -> Dict:
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
// General imports
|
||||
@import "../partials/variables";
|
||||
@import "../components/index";
|
||||
|
||||
// Page specific
|
||||
@import "./components/index";
|
||||
0
src/newsreader/scss/elements/index.scss
Normal file
0
src/newsreader/scss/elements/index.scss
Normal file
|
|
@ -1,7 +0,0 @@
|
|||
// General imports
|
||||
@import "../partials/variables";
|
||||
@import "../components/index";
|
||||
|
||||
// Page specific
|
||||
@import "./components/index";
|
||||
@import "./elements/index";
|
||||
8
src/newsreader/scss/pages/homepage/index.scss
Normal file
8
src/newsreader/scss/pages/homepage/index.scss
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// General imports
|
||||
@import "../../partials/variables";
|
||||
@import "../../components/index";
|
||||
@import "../../elements/index";
|
||||
|
||||
// Page specific
|
||||
@import "./components/index";
|
||||
@import "./elements/index";
|
||||
7
src/newsreader/scss/pages/login/index.scss
Normal file
7
src/newsreader/scss/pages/login/index.scss
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
// General imports
|
||||
@import "../../partials/variables";
|
||||
@import "../../components/index";
|
||||
@import "../../elements/index";
|
||||
|
||||
// Page specific
|
||||
@import "./components/index";
|
||||
Loading…
Add table
Add a link
Reference in a new issue