Fomantic-UI Documentation

repository·develop·Indexed 26 days ago

https://github.com/fomantic/fomantic-ui

A community-driven fork of Semantic-UI providing a responsive, concise, and intuitive front-end framework. Version 2.9.4 supports installation via npm (standard, nightly, CSS-only, and LESS) and Ruby Gem (SASS). The framework features a three-level theme inheritance model (Default, Packaged, and Site) and provides Gulp tasks for building and watching CSS. It includes detailed configuration options via theme.config for global settings, elements, collections, modules, and views.

Tokens
2.1K
Snippets
11
Records
20
Agent score
86%

What's inside Fomantic-UI

  1. Understand Fomantic-UI theming inheritance and structure

    develop

    Fomantic-UI uses a three-level inheritance model for themes:

    1. Default theme: The neutral default theme.
    2. Packaged theme: A specific pre-packaged theme (e.g., "amazon" or "material").
    3. Site theme: A theme specific to your own site.

    Folder Structure:

    • definitions/: Contains CSS and JavaScript definitions for each component.
    • themes/: Contains pre-packaged themes, including the default theme.
    • site/: Contains your custom site theme.
  2. Report bugs and suggest enhancements

    develop

    When reporting bugs or suggesting enhancements on GitHub, follow these steps to ensure your issue can be triaged:

    1. Check if the issue has already been raised.
    2. Create a reproducible example using this JSFiddle boilerplate.
    3. For bugs, include a test case. If the bug is in the documentation, link to the specific documentation example and explain how to reproduce it.
    4. For enhancements, explain clearly what you want (using JSFiddle is optional but encouraged).
  3. Import task collections into Gulp

    develop

    You can import collections of tasks into a Gulp workflow by requiring the tasks/collections/install module. This module injects the necessary tasks into your Gulp instance, making them available for execution (e.g., via gulp.start).

    const gulp = require('gulp');
    // modified to point to semantic folder
    const install = require('tasks/collections/install');
    gulp = install(gulp);
    
    // tasks are now injected and ready to be used
    gulp.start('install');
  4. Import Fomantic-UI components in LESS

    develop

    To use Fomantic-UI source files in your own LESS files, you must first prepare your environment by renaming theme.config.example to theme.config and renaming the _site/ folder to site/.

    Importing all components:

    /* Import all components */
    @import 'src/semantic';

    Importing individual components: You must wrap individual component imports in a scope using & {} to ensure correct nesting.

    /* Import a specific component */
    & { @import 'src/definitions/elements/button'; }

    Note: LESS files do not contain vendor prefixes. You must add them during your build step.

  5. Use Fomantic-UI Gulp tasks in your own project

    develop

    Fomantic-UI provides pre-defined Gulp tasks that you can import directly into your own gulpfile.js. This allows you to leverage Fomantic's build logic (such as watching for changes or building files) without needing to use the full Fomantic build toolchain manually.

    Available tasks include:

    • Watch: Compiles only changed files from the source.
    • Build: Builds all files from the source.
    • Version: Outputs the current version number.
    • Install: Runs the Installer to set up paths.
    const watch = require('path/to/fomantic/tasks/watch');
    gulp.task('watch ui', watch);
  6. Install specialized Fomantic-UI packages

    develop

    Depending on your environment, you may want to install specific versions of Fomantic-UI:

    • CSS Only: npm install fomantic-ui-css
    • LESS: npm install fomantic-ui-less
    • SASS: gem 'fomantic-ui-sass'
    # CSS Only
    npm install fomantic-ui-css
    
    # LESS
    npm install fomantic-ui-less
    
    # SASS (Ruby Gem)
    gem 'fomantic-ui-sass'
  7. Import Fomantic-UI Gulp tasks into your own project

    develop

    You can integrate Fomantic-UI's Gulp tasks directly into your own Gulpfile by requiring the specific task files.

    const watch = require('path/to/semantic/tasks/watch');
    
    gulp.task('watch ui', 'Watch Fomantic-UI', watch);
  8. Install and build Fomantic-UI using Gulp

    develop

    To set up the Fomantic-UI development environment, run npm install from the Fomantic directory. A post-install script will automatically configure the package. Once set up, you can use the built-in Gulp tasks to manage your CSS builds.

    Use gulp watch to monitor files for changes and gulp build to compile all files.

    npm install
    
    # Watch files
    gulp watch
    
    # Build all files
    gulp build
  9. Advanced component customization

    develop

    For more granular control, you can customize individual components:

    1. Component Variables: Modify specific variables for a component in its dedicated variable file (e.g., /site/elements/button.variables).
    2. Component Overrides: Specify custom LESS in /site/elements/button.overrides. This file has access to all underlying variables available for that specific component.
  10. Customize Fomantic-UI via site variables

    develop

    The simplest way to customize Fomantic-UI is by overriding variables in your site/variables/site.variables file. This file acts as a stub for overriding global settings such as:

    • Base font size
    • Named color hex codes
    • Header/Page Font-families
    • Primary and secondary colors
    • Grid column count

    To see all available variables, inspect the default theme files located in themes/default/.