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

Enhancement/issue 763 parcel css bundling #977

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions greenwood.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ export default {
staticRouter: true,
interpolateFrontmatter: true,
plugins: [
...greenwoodPluginGraphQL(),
...greenwoodPluginPolyfills(),
greenwoodPluginGraphQL(),
greenwoodPluginPolyfills(),
greenwoodPluginPostCss(),
...greenwoodPluginImportJson(),
...greenwoodPluginImportCss(),
greenwoodPluginImportJson(),
greenwoodPluginImportCss(),
{
type: 'rollup',
name: 'rollup-plugin-analyzer',
Expand All @@ -34,8 +34,8 @@ export default {
];
}
},
...greenwoodPluginIncludeHTML(),
...greenwoodPluginRendererPuppeteer()
greenwoodPluginIncludeHTML(),
greenwoodPluginRendererPuppeteer()
],
markdown: {
plugins: [
Expand Down
4 changes: 1 addition & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,19 @@
"access": "public"
},
"dependencies": {
"@parcel/css": "^1.13.1",
"@rollup/plugin-node-resolve": "^13.0.0",
"@rollup/plugin-replace": "^2.3.4",
"acorn": "^8.0.1",
"acorn-walk": "^8.0.0",
"commander": "^2.20.0",
"cssnano": "^5.0.11",
"es-module-shims": "^1.2.0",
"front-matter": "^4.0.2",
"koa": "^2.13.0",
"livereload": "^0.9.1",
"markdown-toc": "^1.2.0",
"node-fetch": "^2.6.1",
"node-html-parser": "^1.2.21",
"postcss": "^8.3.11",
"postcss-import": "^13.0.0",
"rehype-raw": "^5.0.0",
"rehype-stringify": "^8.0.0",
"remark-frontmatter": "^2.0.0",
Expand Down
17 changes: 5 additions & 12 deletions packages/cli/src/commands/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,15 @@ const runProductionBuild = async (compilation) => {
try {
const { prerender } = compilation.config;
const outputDir = compilation.context.outputDir;
const defaultPrerender = (compilation.config.plugins.filter(plugin => plugin.type === 'renderer' && plugin.isGreenwoodDefaultPlugin) || []).length === 1
? compilation.config.plugins.filter(plugin => plugin.type === 'renderer')[0].provider(compilation)
: {};
const customPrerender = (compilation.config.plugins.filter(plugin => plugin.type === 'renderer' && !plugin.isGreenwoodDefaultPlugin) || []).length === 1
const prerenderPlugin = (compilation.config.plugins.filter(plugin => plugin.type === 'renderer') || []).length === 1
? compilation.config.plugins.filter(plugin => plugin.type === 'renderer')[0].provider(compilation)
: {};

if (!fs.existsSync(outputDir)) {
fs.mkdirSync(outputDir);
}

if (prerender || customPrerender.prerender) {
if (prerender || prerenderPlugin.prerender) {
// start any servers if needed
const servers = [...compilation.config.plugins.filter((plugin) => {
return plugin.type === 'server';
Expand All @@ -42,14 +39,10 @@ const runProductionBuild = async (compilation) => {
return Promise.resolve(server);
}));

if (customPrerender.workerUrl) {
await preRenderCompilationWorker(compilation, customPrerender);
} else if (customPrerender.customUrl) {
await preRenderCompilationCustom(compilation, customPrerender);
} else if (defaultPrerender && prerender) {
await preRenderCompilationWorker(compilation, defaultPrerender);
if (prerenderPlugin.workerUrl) {
await preRenderCompilationWorker(compilation, prerenderPlugin);
} else {
reject('This is an unhandled pre-rendering case! Please report.');
await preRenderCompilationCustom(compilation, prerenderPlugin);
}
} else {
await staticRenderCompilation(compilation);
Expand Down
Loading