ahoff ahoff - 5 months ago 34
Git Question

Semantic UI in .gitignore

I recently started experimenting with Semantic UI. I am using it in a project that I keep in git repo.

I added the Semantic files to the semantic folder in the project root with all the default settings. I may or may not change these settings later.

My question is, how do I properly add the folder to git? I do not want to add files that can later be simply rebuilt using

, if that is possible. What files should I add and what should I ignore?


I ended up partially following @fstanis's answer at How can I separate generated artifacts from the main build with semantic UI?, linked by @poke.

I kept:

  • semantic.json
  • semantic/src/
  • semantic/gulpfile.js (As I do not use gulp elsewhere in the project)

I ignored:

  • semantic/dist/
  • semantic/tasks/, as it is exactly the same as node_modules/semantic-ui/tasks and therefore can be copied

I also augmented semantic/gulpfile.js as follows to check if semantic/tasks is present and copy it there if not.

/* Very top of semantic/gulpfile.js */
var fs = require('fs-extra'); // Used for recursive copying
var path = require('path');
try {
    var stat = fs.statSync(path.join(__dirname, './tasks'));
    console.log('\'tasks\' folder already exists. Continuing.')
} catch (e) {
    console.log('Copying \'tasks\' folder from \'node_modules/semantic-ui/tasks\'');
    fs.copySync(path.join(__dirname, '../node_modules/semantic-ui/tasks'), path.join(__dirname, './tasks'));
    console.log('Copying done! Continuing.');

This seems to be the minimum needed for a buildable Semantic UI installation.