Revert stylegen (#228)

This commit is contained in:
Drew Powers 2021-05-21 14:55:25 -06:00 committed by GitHub
parent 8b6b41eb85
commit c9942c2878
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 28 deletions

View file

@ -5,7 +5,7 @@ import Nav from '../components/Nav/index.jsx';
import Footer from '../components/Footer/index.jsx'; import Footer from '../components/Footer/index.jsx';
import PorfolioPreview from '../components/PortfolioPreview/index.jsx'; import PorfolioPreview from '../components/PortfolioPreview/index.jsx';
const projects = Astro.fetchContent('./project/*.md'); const projects = Astro.fetchContent('./project/**/*.md');
const featuredProject = projects[0]; const featuredProject = projects[0];
--- ---

View file

@ -266,13 +266,12 @@ interface CreateSnowpackOptions {
env: Record<string, any>; env: Record<string, any>;
mode: RuntimeMode; mode: RuntimeMode;
resolvePackageUrl?: (pkgName: string) => Promise<string>; resolvePackageUrl?: (pkgName: string) => Promise<string>;
target: 'frontend' | 'backend';
} }
/** Create a new Snowpack instance to power Astro */ /** Create a new Snowpack instance to power Astro */
async function createSnowpack(astroConfig: AstroConfig, options: CreateSnowpackOptions) { async function createSnowpack(astroConfig: AstroConfig, options: CreateSnowpackOptions) {
const { projectRoot, astroRoot, extensions } = astroConfig; const { projectRoot, astroRoot, extensions } = astroConfig;
const { env, mode, resolvePackageUrl, target } = options; const { env, mode, resolvePackageUrl } = options;
const internalPath = new URL('./frontend/', import.meta.url); const internalPath = new URL('./frontend/', import.meta.url);
@ -296,28 +295,6 @@ async function createSnowpack(astroConfig: AstroConfig, options: CreateSnowpackO
mountOptions[fileURLToPath(astroConfig.public)] = '/'; mountOptions[fileURLToPath(astroConfig.public)] = '/';
} }
const plugins: (string | [string, any])[] = [
[fileURLToPath(new URL('../snowpack-plugin.cjs', import.meta.url)), astroPlugOptions],
[require.resolve('@snowpack/plugin-svelte'), { compilerOptions: { hydratable: true } }],
require.resolve('@snowpack/plugin-vue'),
];
// note: styles only need processing once
if (target === 'frontend') {
plugins.push(require.resolve('@snowpack/plugin-sass'));
plugins.push([
require.resolve('@snowpack/plugin-postcss'),
{
config: {
plugins: {
[require.resolve('autoprefixer')]: {},
...(astroConfig.devOptions.tailwindConfig ? { [require.resolve('tailwindcss')]: {} } : {}),
},
},
},
]);
}
// Tailwind: IDK what this does but it makes JIT work 🤷‍♂️ // Tailwind: IDK what this does but it makes JIT work 🤷‍♂️
if (astroConfig.devOptions.tailwindConfig) { if (astroConfig.devOptions.tailwindConfig) {
(process.env as any).TAILWIND_DISABLE_TOUCH = true; (process.env as any).TAILWIND_DISABLE_TOUCH = true;
@ -327,7 +304,23 @@ async function createSnowpack(astroConfig: AstroConfig, options: CreateSnowpackO
root: fileURLToPath(projectRoot), root: fileURLToPath(projectRoot),
mount: mountOptions, mount: mountOptions,
mode, mode,
plugins, plugins: [
[fileURLToPath(new URL('../snowpack-plugin.cjs', import.meta.url)), astroPlugOptions],
[require.resolve('@snowpack/plugin-svelte'), { compilerOptions: { hydratable: true } }],
require.resolve('@snowpack/plugin-vue'),
require.resolve('@snowpack/plugin-sass'),
[
require.resolve('@snowpack/plugin-postcss'),
{
config: {
plugins: {
[require.resolve('autoprefixer')]: {},
...(astroConfig.devOptions.tailwindConfig ? { [require.resolve('tailwindcss')]: {} } : {}),
},
},
},
],
],
devOptions: { devOptions: {
open: 'none', open: 'none',
output: 'stream', output: 'stream',
@ -367,7 +360,6 @@ export async function createRuntime(astroConfig: AstroConfig, { mode, logging }:
}, },
mode, mode,
resolvePackageUrl, resolvePackageUrl,
target: 'backend',
}); });
debug(logging, 'core', `backend snowpack created [${stopTimer(timer.backend)}]`); debug(logging, 'core', `backend snowpack created [${stopTimer(timer.backend)}]`);
@ -377,7 +369,6 @@ export async function createRuntime(astroConfig: AstroConfig, { mode, logging }:
astro: false, astro: false,
}, },
mode, mode,
target: 'frontend',
}); });
debug(logging, 'core', `frontend snowpack created [${stopTimer(timer.frontend)}]`); debug(logging, 'core', `frontend snowpack created [${stopTimer(timer.frontend)}]`);