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/upgrade greenwood 0.31.0 no fontawesome plugin #101

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
3 changes: 2 additions & 1 deletion .ls-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ ls:

ignore:
- .git
- node_modules
- node_modules
- public
33 changes: 31 additions & 2 deletions greenwood.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,35 @@
import { greenwoodPluginFontAwesome } from '@analogstudiosri/greenwood-plugin-font-awesome';
// import { greenwoodPluginFontAwesome } from '@analogstudiosri/greenwood-plugin-font-awesome';
import { greenwoodPluginGoogleAnalytics } from '@greenwood/plugin-google-analytics';
import { greenwoodPluginTypeScript } from '@greenwood/plugin-typescript';
import { greenwoodPluginPostCss } from '@greenwood/plugin-postcss';
import analyze from 'rollup-plugin-analyzer';
import { visualizer } from 'rollup-plugin-visualizer';
import dynamicImportVariables from '@rollup/plugin-dynamic-import-vars';
import { ResourceInterface } from '@greenwood/cli/src/lib/resource-interface.js';

class ProcessEnvReplaceResource extends ResourceInterface {
constructor(compilation) {
super();

this.compilation = compilation;
}

async shouldIntercept(url) {
return url.pathname.endsWith('redux.mjs');
}

async intercept(url, request, response) {
const body = await response.text();
const env = process.env.__GWD_COMMAND__ === 'develop' ? 'development' : 'production'; // eslint-disable-line no-underscore-dangle
const contents = body.replace(/process.env.NODE_ENV/g, `"${env}"`);

return new Response(contents, {
headers: new Headers({
'Content-Type': 'text/javascript'
})
});
}
}

export default {
optimization: 'inline',
Expand All @@ -18,7 +43,7 @@ export default {
},
plugins: [
greenwoodPluginPostCss(),
greenwoodPluginFontAwesome(),
// greenwoodPluginFontAwesome(),
greenwoodPluginTypeScript(),
// https://developers.google.com/analytics/devguides/collection/analyticsjs/single-page-applications
greenwoodPluginGoogleAnalytics({
Expand Down Expand Up @@ -55,6 +80,10 @@ export default {
})
];
}
}, {
type: 'resource',
name: 'process-env-replace',
provider: (compilation) => new ProcessEnvReplaceResource(compilation)
}
]
};
Loading