DEV Community

Cover image for How to Style with Prompts
FSCSS tutorial
FSCSS tutorial

Posted on

How to Style with Prompts

🧩 How to Style with Prompts using FSCSS

FSCSS allows you to style with descriptive prompts instead of manual CSS syntax.
It interprets text prompts into valid CSS — perfect for developers who love writing in a natural, expressive way.


🧠 Example 1: Setting up variables with str()

/* str(A styled card, " the value here ") */
.card {
  A styled card
}
Enter fullscreen mode Exit fullscreen mode

✨ Example 2: Adding smooth hover transitions

/* str(add smooth hover, "
transition: all 0.3s ease;
&:hover{
  transform: translateX(-10px);
  box-shadow: 0 0 4px #069;
}") */

.card {
  transform: translateX(0);
  box-shadow: 0 0 4px #000;
  add smooth hover
}

Enter fullscreen mode Exit fullscreen mode

🌍 External Prompt Imports

If your prompt variables are external, import them using:

@import(exec(your_prompts.fscss))
Enter fullscreen mode Exit fullscreen mode

Example import:

@import(exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@refs/heads/main/xf/styles/prompts.fscss))

body {
  High contrast dark aesthetic with soft glow
}

.card {
  /* card style */
  Smooth gradient background with subtle lighting

  /* center content */
  center content

  /* Define height */
  height should be 200px

  /* add hover transition */
  then_ add smooth hover

  /* add animation */
  add pulse animation
}

/* Define pulse keyframes */
pulse keyframes

.box {
  /* ... */
}

Enter fullscreen mode Exit fullscreen mode

⚙️ Running FSCSS

When running locally (Node.js backend):

fscss your_file.fscss your_file.css
Enter fullscreen mode Exit fullscreen mode

After installing FSCSS version 1.1.7.


🧩 Runtime Import Example (Browser)

You can load FSCSS on the client side using the runtime loader:

<head>
  <script src="https://cdn.jsdelivr.net/npm/fscss@1.1.7/e/exec.min.js" defer></script>
  <style>
    @import(exec(your_file.fscss))
  </style>
</head>

Enter fullscreen mode Exit fullscreen mode

💬 Feedback Request

FSCSS is built to make CSS more natural and flexible — blending AI-like prompt styling with CSS precision.
Would love your feedback on:

  • Clarity of the str() and import() methods

  • Runtime vs backend usage

  • Any prompt syntax you’d like to see supported

🧑‍💻 Your input helps refine this paradigm — respectfully crafted for front-end devs ❤️

Top comments (0)