Recent searches


No recent searches

rollup-plugin-sass Undefined variable



Posted Dec 18, 2024

I am using a fresh copy of https://github.com/zendesk/copenhagen_theme which uses scss. When I add a new variable in manifest.json and use it, I get an error if I use it in scss.

 

This is how I add “brand_color_primary_button” in manifest.json. This adds it to the side option panel. No issue there.

{
  "name": "Starter master theme",
  "author": "Plement",
  "version": "1.0.2",
  "api_version": 4,
  "default_locale": "en-us",
  "settings": [
    {
      "label": "colors_group_label",
      "variables": [
        {
          "identifier": "brand_color_primary_button",
          "type": "color",
          "description": "brand_color_primary_button_description",
          "label": "brand_color_primary_button_label",
          "value": "#AE82EF"
        },

In scss is like this:

.btn {
	background-color: $brand_color_primary_button;
}

The error I am getting:

(plugin rollup-plugin-sass) Error: Undefined variable.
  ╷
7 │   background-color: $brand_color_primary_button;
  │                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵
  styles/_base.scss 7:21  @import
  styles/index.scss 40:9  root stylesheet
styles/index.scss

Dont know why it is happening…. Making the properties shorter is not helping. 

 


0

2

2 comments

Looks like I found the issue. Any added variables to manifest.json will not be usable in SCSS right away. I need to stop my terminal and run `npm run start` again each time something is added

0


image avatar

Emily Reidy

Community Product Feedback Specialist

Hey Alex,
 
Thank you for taking the time to provide us with your feedback. This has been logged for our PM team to review. For others who may be interested in this feature request or are experiencing similar issues to what Alex experienced, please add your support by upvoting this post and/or adding your use case to the comments below. Thank you again!

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post