Restructure scss file layout & task
This commit is contained in:
parent
bb0c2e792c
commit
a350cc280d
48 changed files with 48 additions and 39 deletions
40
gulp/sass.js
40
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`)
|
||||
.pipe(sass().on('error', sass.logError))
|
||||
.pipe(concat('accounts.css'))
|
||||
.pipe(dest(`${ACCOUNTS_DIR}/accounts/dist/css`));
|
||||
};
|
||||
|
||||
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`));
|
||||
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(`${name}.css`))
|
||||
.pipe(dest(destDir));
|
||||
};
|
||||
});
|
||||
|
||||
series(...tasks)(done);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue