• Stars
    star
    224
  • Rank 177,792 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 10 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Official Semantic UI Integration for Meteor

Semantic UI for Meteor

This package integrates Semantic UI into Meteor and lets you configure what parts you need.

Installation

Meteor <1.3

meteor add semantic:ui flemay:less-autoprefixer jquery

Continue to the Usage section.

Meteor 1.3+

meteor remove standard-minifier-css

meteor add semantic:ui juliancwirko:postcss less jquery

Add the following to package.json

{
  "devDependencies": {
    "autoprefixer": "^6.3.1",
    "postcss": "^6.0.22",
    "postcss-load-config": "^1.2.0"
  },
  "postcss": {
    "plugins": {
      "autoprefixer": {"browsers": ["last 2 versions"]}
    }
  }
}

After saving the changes to package.json, run:

meteor npm install

Usage

  1. Create an empty custom.semantic.json inside a /client/ folder somewhere in your project.
    Example: /client/lib/semantic-ui/custom.semantic.json.
  2. Start meteor
  3. Edit the file custom.semantic.json to select only the definitions and themes you want
    Example: set themes basic to true, leave default as true
  4. Save the file and it will generate Semantic UI
  5. Check the generated-structure table below for editable files and folders.

IMPORTANT: If you are happy with the default values you will NEED to remove .custom.semantic.json to generate Semantic UI. (see Generating Trigger)

NOTE: Another way to use ONLY the default values is to use this package: https://atmospherejs.com/semantic/ui-css meteor add semantic:ui-css

Getting Started & Initializing Modules

Semantic UI requries some components to be initialized or they will not work (Dropdowns, Menus, Accordions, etc) Refer to the Usage sections in a module on how to initialize each element eg: Semantic UI Accordion Usage

Example of initializing a dropdown using a template helper

Template.myDropdown.rendered = function() {
  // be sure to use this.$ so it is scoped to the template instead of to the window
  this.$('.ui.dropdown').dropdown({on: 'hover'});
  // other SUI modules initialization
};

Abstracted version which you use on any template helper

function initAccordions(template) {
  template.$('.ui.accordion').accordion();
}
function initDropdowns(template) {
  template.$('.ui.dropdown').dropdown({on: 'hover'});
}

Template.myDropdowns.onRendered({
  initDropdowns(this);
})

custom.semantic.json

custom.semantic.json is the most important file. If it is empty, semantic:ui will generate the content with all the definitions and themes. By default, it sets to true all definitions and the core-theme "default"(which should always be true).

{
  "definitions": {
    "accordion": true,
    "ad": true,
    "api": true,
    ...
  },
  "themes": {
    "amazon": false,
    "basic": false,
    "bookish": false,
    "bootstrap3": false,
    "chubby": false,
    "classic": false,
    "default": true,
    ...
  }
}

Changing any value will trigger the package to regenerate the files/folders accordingly.

Be aware when you strip away definitions. The site definition is always needed and so is the default theme. Here an example of the most minimal custom.semantic.json file.

{
  "definitions": {
    "site": true // <- needs to be true
  },
  "themes": {
    "basic": true, // <- a theme
    "default": true // <- core "theme" needs to be true
  }
}

Generated Structure

This package generates the following structure based on custom.semantic.json

+- definitions/
+- site/
+- themes/
|- .custom.semantic.json
|- custom.semantic.json
|- semantic.less
|- theme.config.import.less
|- theme.import.less

The following table explains the generated files/folders and if they are editable without losing any changes when generating.

File/Folder Description Generated Editable
definitions/ contains the less and javascript definitions for each component always no
site/ contains your current site's theme only if it does not exist yes
themes/ contains pre-packaged themes including Semantic's default theme always no
.custom.semantic.json copy of custom.semantic.json (see Generating Trigger) always no
custom.semantic.json contains definitions and themes to be included or not only if the file is empty yes
semantic.less imports the definitions always no
theme.config.import.less defines which theme to use per components only if the file does not exist yes
theme.import.less imports the right themes always no

site/

This folder contains your current site's theme. It is generated only when it does not exist. Therefore if you change custom.semantic.json to turn definitions/themes on/off, then it will not affect site/. You will either need to add/remove files in site/ or remove the site/ folder so it can be regenerated again.

Generating Trigger

Every time Meteor starts (or refreshes) it calls the package semantic:ui to generate Semantic UI.

The package has a simple mechanism based on the difference of custom.semantic.json and .custom.semantic.json to avoid generating all the Semantic UI files and folders each time Meteor starts (or refreshes).

Therefore if the file .custom.semantic.json does not exist or it is different from custom.semantic.json then it will generate Semantic UI.

Dependencies

(Meteor <1.3) flemay:less-autoprefixer: Semantic UI needs autoprefixer to be compiled.

Note 1: You can choose any less-autoprefixer package.

Note 2: Since the flemay:less-autoprefixer package compiles LESS files you don't need the less package.

(Meteor 1.3+) juliancwirko:postcss: Semantic UI needs autoprefixer for adding vendor prefixes.

(Meteor 1.3+) less: is needed to compile the LESS files to CSS when building.

semantic:ui-data is being used to get Semantic UI files.

Contributing

Contributors are very welcome.

License

MIT license

Credits and Acknowledgements

nemo64:bootstrap: semantic:ui has been inspired by nemo64:bootstrap. It uses a very similar approach.

More Repositories

1

Semantic-UI

Semantic is a UI component framework based around useful principles from natural language.
JavaScript
50,753
star
2

Semantic-UI-React

The official Semantic-UI-React integration
JavaScript
13,117
star
3

Semantic-UI-Angular

Semantic UI Angular Integrations
TypeScript
561
star
4

Semantic-UI-CSS

CSS Only distribution
JavaScript
478
star
5

Semantic-UI-Ember

Official Semantic UI Integration for Ember
JavaScript
330
star
6

Semantic-UI-Docs

Official Documentation for Semantic UI
JavaScript
301
star
7

Semantic-UI-LESS

LESS only distribution
JavaScript
201
star
8

example-github

Example repo using Semantic UI to replicate GitHub Project Home
CSS
149
star
9

Semantic-UI-Rails-LESS

This is a gem for Rails with Semantic UI (http://semantic-ui.com) assets inside.
JavaScript
123
star
10

Semantic-UI-ar

سيمانتك يو آي تزيد فاعلية العمل بين المصممين و المطورين من خلال مفردات ذات دلالة لفظية مشتركة لبناء واجهة المستخدم
JavaScript
42
star
11

Example-External-Gulpfile

Example of importing gulp tasks into your gulpfile
JavaScript
27
star
12

UI-Dropdown

A dropdown allows a user to select a value from a series of options
JavaScript
24
star
13

Learn-Semantic

Official repo of learnsemantic.com
JavaScript
24
star
14

Semantic-UI-Angular2

20
star
15

UI-Icon

An icon is a glyph used to represent a concept
CSS
14
star
16

Semantic-UI-SASS

Semantic UI SASS Port
13
star
17

UI-Modal

A modal displays content that temporarily blocks interactions with the main view of a site
JavaScript
13
star
18

UI-Sidebar

A sidebar hides additional content beside a page.
JavaScript
13
star
19

UI-Transition

A transition is an animation usually used to move content in or out of view
JavaScript
12
star
20

UI-Card

A card displays site content in a manner similar to a playing card
CSS
10
star
21

UI-Button

A button indicates a possible user action
CSS
9
star
22

UI-Search

A search element allows a user to query for results from a selection of data
JavaScript
9
star
23

UI-Flag

A flag is is used to represent a political state
CSS
8
star
24

UI-Loader

A loader alerts a user to wait for an activity to complete
CSS
8
star
25

UI-Menu

A menu displays grouped navigation actions
CSS
8
star
26

UI-Popup

A popup displays additional information on top of a page
JavaScript
8
star
27

Module-Examples

Annotated source of Semantic UI Module Format
JavaScript
7
star
28

UI-Form

A form displays a set of related user input fields in a structured way
JavaScript
7
star
29

UI-Table

A table displays a collections of data grouped into rows
CSS
7
star
30

UI-Visibility

Visibility provides a set of callbacks for when a content appears in the viewport
JavaScript
6
star
31

Semantic-UI-Meteor-Data

Data package for Semantic UI Meteor
JavaScript
6
star
32

UI-Progress

A progress bar shows the progression of a task
JavaScript
5
star
33

UI-Site

A site is a set of global constraints that define the basic parameters of all UI elements
JavaScript
5
star
34

UI-Checkbox

A checkbox allows a user to select a value from a small set of options, often binary
JavaScript
5
star
35

UI-Embed

An embed displays content from other websites like YouTube videos or Google Maps
JavaScript
5
star
36

UI-Grid

A grid is used to harmonize negative space in a layout
CSS
5
star
37

UI-Rating

A rating indicates user interest in content
JavaScript
4
star
38

UI-Placeholder

Semantic UI placeholder component
CSS
4
star
39

UI-Step

A step shows the completion status of an activity in a series of activities
CSS
4
star
40

UI-Tab

A tab is a hidden section of content activated by a menu
JavaScript
4
star
41

UI-Item

An item view presents large collections of general site content for display
CSS
4
star
42

UI-Reset

A reset is a set of normalized values for CSS properties that correct for abberations in browser defaults
CSS
4
star
43

UI-Label

A label is used to display content classification
CSS
4
star
44

UI-Sticky

Sticky content fixes itself to the browser viewport as content is scrolled
JavaScript
4
star
45

UI-Api

API allows elements to trigger actions on a server
JavaScript
4
star
46

UI-Container

CSS
3
star
47

UI-Statistic

A statistic displays the current value of an attribute
CSS
3
star
48

UI-Accordion

An accordion allows users to toggle the display of sections of content
JavaScript
3
star
49

UI-Video

This is a legacy component and is no longer maintained
JavaScript
3
star
50

UI-Reveal

A reveal displays additional content in place of previous content when activated
CSS
3
star
51

UI-Divider

A divider visually segments content into groups
CSS
3
star
52

UI-Nag

A nag is an important message that persists until dismissed by a user
JavaScript
3
star
53

UI-Message

A message displays information that explains nearby content
CSS
3
star
54

UI-Segment

A segment is used to create a grouping of related content
CSS
3
star
55

Semantic-UI-Legacy

Hosts pre-release version of library and documentation
JavaScript
2
star
56

UI-List

A list is used to group related content
CSS
2
star
57

UI-Breadcrumb

A breadcrumb is used to show heirarchy between content
CSS
2
star
58

UI-Image

An image is a graphic representation of something
CSS
2
star
59

Semantic-UI-Docs-Api

Sequelize / Express Server For API Demos
JavaScript
2
star
60

UI-Ad

CSS
2
star
61

UI-Feed

A feed presents user activity chronologically
CSS
2
star
62

UI-Comment

A comment displays user feedback to site content
CSS
2
star
63

UI-Dimmer

A dimmer hides distractions to focus attention on particular content
JavaScript
2
star
64

UI-Shape

A shape is a three dimensional object displayed on a two dimensional plane
JavaScript
2
star
65

Semantic-UI-1.0-Docs

This repository hosts deployed files for 1.x Semantic UI Docs
JavaScript
2
star
66

UI-Header

A header provides a short summary of content
CSS
1
star
67

Semantic-UI-Beta-Docs

Docs for beta version of Semantic UI
JavaScript
1
star
68

UI-Input

An input is a field used to elicit a response from a user
CSS
1
star
69

UI-Rail

A rail is used to show accompanying content outside the boundaries of the main view of a site
CSS
1
star