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

CSS applied to CMS dashboard instead of Preview Panel in local environment #618

Open
mikeyrayvon opened this issue Aug 18, 2020 · 0 comments

Comments

@mikeyrayvon
Copy link

mikeyrayvon commented Aug 18, 2020

Bug report

What is the current behavior?
In the deployed Netlify CMS, project CSS is correctly applied to the Preview Panel. However, on the Netlify CMS of my local dev environment, project CSS is applied to the entire Netlify CMS dashboard, and not the Preview Panel.

My repo can be found here

The only CSS I have in my project is:

div {
  background: green;
}

and my local CMS looks like this:

Screen Shot 2020-08-18 at 11 16 54

whereas the deployed CMS looks like this:

Screen Shot 2020-08-18 at 11 23 54

If the current behavior is a bug, please provide the steps to reproduce.
I'm using Stylus with gatsby-plugin-stylus, but I don't believe the issue to be with the plugin, because CSS is working correctly everywhere except for the local Netlify CMS.

// gatsby-config.js
...
plugins: [
  ...
  {
    resolve: `gatsby-plugin-stylus`,
    options: {
      preferPathResolver: 'webpack', // Faster
      'resolve url': true,
    },
  },
  ...
],
...
// src/components/Layout.js

import '../css/site.styl'

...
// cms/cms.js

import CMS from 'netlify-cms-app'

import IndexPagePreview from './preview-templates/IndexPagePreview'

CMS.registerPreviewTemplate('index', IndexPagePreview)
// cms/preview-templates/IndexPagePreview 

...
import { IndexPageTemplate } from '../../templates/index-page'

const IndexPagePreview = ({ entry, getAsset }) => {
  const data = entry.getIn(['data']).toJS()

  if (data) {
    return (
      <IndexPageTemplate
        title={data.title}
      />
    )
  } else {
    return <div>Loading...</div>
  }
}

...
// src/templates/index-page.js 

...

export const IndexPageTemplate = ({
  title
}) => {
  return (
    <>
      <Link to='/'>{title}</Link>
    </>
  )
}

...
// src/css/site.styl 

div
  background: green

This is causing every div in the local Netlify CMS to have a green background, but the local Preview Panel still has totally default styles.

What is the expected behavior?
Project CSS should only be applied to the Preview Panel and not the Netlify CMS dashboard itself for the local environment and deployed site.

Other relevant information:

  • I'm not getting any build errors/warnings in my terminal.
  • http://localhost:8000/admin/#/collections/pages/entries/index has this warning in the console: Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:8000/admin/cms.css".
System:
    OS: macOS Mojave 10.14.5
    CPU: (4) x64 Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz
    Shell: 3.2.57 - /bin/bash
Binaries:
    Node: 10.13.0 - ~/.nvm/versions/node/v10.13.0/bin/node
    Yarn: 1.16.0 - ~/.yarn/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v10.13.0/bin/npm
Languages:
    Python: 2.7.14 - /anaconda2/bin/python
Browsers:
    Chrome: 84.0.4147.125
    Firefox: 74.0.1
    Safari: 13.1.1
npmGlobalPackages:
    gatsby-cli: 2.12.87
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant