Skip to content

Instantly share code, notes, and snippets.

@furzeface
Created June 14, 2018 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save furzeface/b365e7d4476c85a0edb4a0956aa60501 to your computer and use it in GitHub Desktop.
Save furzeface/b365e7d4476c85a0edb4a0956aa60501 to your computer and use it in GitHub Desktop.
ITCSSify things. I keep needing to do this when refactoring legacy projects.
#!/bin/bash
mkdir -p ./src/styles
touch ./src/styles/main.scss
mkdir -p ./src/styles/{base,components,generic,objects,settings,tools,trumps}
touch ./src/styles/{base,components,generic,objects,settings,tools,trumps}/__index.scss
echo "// Base - Unclassed HTML elements (type selectors)" > ./src/styles/base/__index.scss
echo "// Components - Designed components, chunks of UI" > ./src/styles/components/__index.scss
echo "// Generic - Ground-zero styles (normalize, resets, box-sizing etc)" > ./src/styles/generic/__index.scss
echo "// Objects - Cosmetic-free design patterns" > ./src/styles/objects/__index.scss
echo "// Settings - Global variables, config switches" > ./src/styles/settings/__index.scss
echo "// Tools - Default mixins and functions" > ./src/styles/tools/__index.scss
echo "// Trumps - Helpers and overrides" > ./src/styles/trumps/__index.scss
echo "/* ============================================================ *\\
# Client name: Project name
/* ============================================================ */
/**
* Settings - Global variables, config switches
* Tools - Default mixins and functions
* Generic - Ground-zero styles (normalize, resets, box-sizing etc)
* Base - Unclassed HTML elements (type selectors)
* Objects - Cosmetic-free design patterns
* Components - Designed components, chunks of UI
* Trumps - Helpers and overrides
*/
@import 'settings/_index';
@import 'tools/_index';
@import 'generic/_index';
@import 'base/_index';
@import 'objects/_index';
@import 'components/_index';
@import 'trumps/_index';" > ./src/styles/main.scss
# test it out
mkdir -p ./public/styles
sass ./src/styles/main.scss ./public/styles/main.css
@furzeface
Copy link
Author

Sets up the relevant directories, imports and comments in files for restructuring legacy (S)CSS into more of an ITCSS structure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment