teleport-code-generators icon indicating copy to clipboard operation
teleport-code-generators copied to clipboard

Page or component style page-name should be different from global-styles

Open JayaKrishnaNamburu opened this issue 3 years ago • 2 comments

Change the global-stylesheet name to global-style across all flavours. In certain flavours we are having the name of pages and global styles as same. This is creating a clash for the imports. Here is a example to reproduce it https://codesandbox.io/s/d039b?file=/src/routes/home/index.js

Since we save the dependencies from plugins using a Record<string, UIDLDependency>. When the file names are same and still paths are different, while saving with the DS we do using file name alone and not path. So the dependencies are joining even paths are different.

Expected

import projectStyles from '../../style.css'
import styles from './style.css'

Current behaviour

import projectStyles, { styles } from './style.css'

JayaKrishnaNamburu avatar Oct 22 '21 04:10 JayaKrishnaNamburu

This is solved in teleport-project-generator-preact. That can be taken as reference to do the same for the rest of the frameworks.

JayaKrishnaNamburu avatar May 04 '22 11:05 JayaKrishnaNamburu

https://github.com/teleporthq/teleport-code-generators/blob/development/packages/teleport-project-generator-preact/src/index.ts#L56

https://github.com/teleporthq/teleport-code-generators/blob/development/packages/teleport-project-generator-preact/src/index.ts#L24

JayaKrishnaNamburu avatar May 05 '22 04:05 JayaKrishnaNamburu