UNPKG

ember-codemod-css-modules

Version:

Codemod to replace ember-component-css with ember-css-modules (compatible with embroider-css-modules)

14 lines (13 loc) 488 B
import { existsSync } from 'node:fs'; import { createClass } from './import-styles/create-class.js'; import { updateClass } from './import-styles/update-class.js'; export function importStylesInComponents(context, options) { for (const entry of context) { const { jsPath } = entry; const hasClass = existsSync(`${options.projectRoot}/${jsPath}`); if (!hasClass) { createClass(entry, options); } updateClass(entry, options); } }