Category pages
This commit is contained in:
parent
a350cc280d
commit
b952d70d92
114 changed files with 1205 additions and 177 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import path from 'path';
|
||||
|
||||
import { dest } from 'gulp';
|
||||
import { dest, series } from 'gulp';
|
||||
import babelify from 'babelify';
|
||||
import browserify from 'browserify';
|
||||
import source from 'vinyl-source-stream';
|
||||
|
|
@ -8,21 +8,37 @@ import buffer from 'vinyl-buffer';
|
|||
import concat from 'gulp-concat';
|
||||
|
||||
const PROJECT_DIR = path.join('src', 'newsreader');
|
||||
const STATIC_DIR = path.join(PROJECT_DIR, 'js');
|
||||
const CORE_DIR = path.join(PROJECT_DIR, 'news', 'core', 'static');
|
||||
const SRC_DIR = path.join(PROJECT_DIR, 'js');
|
||||
const STATIC_SUFFIX = 'dist/js/';
|
||||
|
||||
const babelTask = () => {
|
||||
const config = browserify({
|
||||
entries: `${STATIC_DIR}/homepage/index.js`,
|
||||
debug: true,
|
||||
}).transform(babelify);
|
||||
const CORE_DIR = path.join(PROJECT_DIR, 'news', 'core', 'static', 'core');
|
||||
|
||||
return config
|
||||
.bundle()
|
||||
.pipe(source('index.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(concat('homepage.js'))
|
||||
.pipe(dest(`${CORE_DIR}/core/dist/js/`));
|
||||
const taskMappings = [
|
||||
{ name: 'homepage', destDir: `${CORE_DIR}/${STATIC_SUFFIX}` },
|
||||
{ name: 'categories', destDir: `${CORE_DIR}/${STATIC_SUFFIX}` },
|
||||
];
|
||||
|
||||
const babelTask = done => {
|
||||
const tasks = taskMappings.map(taskMapping => {
|
||||
const { name, destDir } = taskMapping;
|
||||
|
||||
const bundle = browserify({
|
||||
entries: `${SRC_DIR}/pages/${name}/index.js`,
|
||||
debug: true,
|
||||
});
|
||||
|
||||
const transpiledBundle = bundle.transform(babelify);
|
||||
|
||||
return () =>
|
||||
transpiledBundle
|
||||
.bundle()
|
||||
.pipe(source('index.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(concat(`${name}.js`))
|
||||
.pipe(dest(destDir));
|
||||
});
|
||||
|
||||
return series(...tasks)(done);
|
||||
};
|
||||
|
||||
export default babelTask;
|
||||
|
|
|
|||
10
gulp/sass.js
10
gulp/sass.js
|
|
@ -14,19 +14,19 @@ export const CORE_DIR = path.join(PROJECT_DIR, 'news', 'core', 'static', 'core')
|
|||
const taskMappings = [
|
||||
{ name: 'login', destDir: `${ACCOUNTS_DIR}/${STATIC_SUFFIX}` },
|
||||
{ name: 'homepage', destDir: `${CORE_DIR}/${STATIC_SUFFIX}` },
|
||||
{ name: 'categories', destDir: `${CORE_DIR}/${STATIC_SUFFIX}` },
|
||||
{ name: 'category', destDir: `${CORE_DIR}/${STATIC_SUFFIX}` },
|
||||
];
|
||||
|
||||
export const sassTask = done => {
|
||||
const tasks = taskMappings.map(taskMapping => {
|
||||
const name = taskMapping.name;
|
||||
const destDir = taskMapping.destDir;
|
||||
const { name, destDir } = taskMapping;
|
||||
|
||||
return () => {
|
||||
return src(`${SRC_DIR}/pages/${name}/index.scss`)
|
||||
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