Permalink
Browse files

Copy tachyons.css and modify for sass compilation

  • Loading branch information...
1 parent 3702d11 commit 2cf15e15c2c82a4f30d06b893098c3dc9daf9b9c @mattclough1 mattclough1 committed Jan 10, 2017
Showing with 15 additions and 35 deletions.
  1. +15 −35 build.js
View
@@ -3,53 +3,33 @@
const fs = require('fs')
const glob = require('glob')
const cssScss = require('css-scss')
+const stream = require('stream');
glob('./node_modules/tachyons/src/**/*.css', (err, files) => {
if (err) {
throw err
}
- var baseFile = ''
files.forEach(file => {
var css = fs.readFileSync(file, 'utf8')
var fileName = file.replace(/(\.\/node_modules\/tachyons\/src\/|\.css)/g, '')
if (fileName !== 'tachyons' && fileName !== '_media-queries' && fileName !== '_colors' && fileName !== '_debug') {
fs.writeFileSync('scss/' + fileName + '.scss', cssScss(css))
- baseFile += '@import "scss/' + fileName + '";\n'
}
})
-
- fs.writeFileSync('tachyons.scss', `
-/*
- * ████████╗ █████╗ ██████╗██╗ ██╗██╗ ██╗ ██████╗ ███╗ ██╗███████╗
- * ╚══██╔══╝██╔══██╗██╔════╝██║ ██║╚██╗ ██╔╝██╔═══██╗████╗ ██║██╔════╝
- * ██║ ███████║██║ ███████║ ╚████╔╝ ██║ ██║██╔██╗ ██║███████╗
- * ██║ ██╔══██║██║ ██╔══██║ ╚██╔╝ ██║ ██║██║╚██╗██║╚════██║
- * ██║ ██║ ██║╚██████╗██║ ██║ ██║ ╚██████╔╝██║ ╚████║███████║
- * ╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝
- *
- * TABLE OF CONTENTS
- *
- * 1. External Library Includes
- * - Normalize.css | http://normalize.css.github.io
- * 2. Tachyons Modules
- * 3. Variables
- * - Media Queries
- * - Colors
- * 4. Debugging
- * - Debug all
- * - Debug children
- *
- */
-
-/* Variables */
-/* Importing here will allow you to override any variables in the modules */
-@import "scss/_media-queries";
-@import "scss/_colors";
-
-/* Uncomment out the line below to help debug layout issues */
-//@import "scss/_debug";
-
-${baseFile}`)
})
+
+const tachyonsCSS = fs.createReadStream('./node_modules/tachyons/src/tachyons.css')
+const tachyonsSCSS = fs.createWriteStream('./tachyons.scss')
+tachyonsCSS.on('data', (data) => {
+ const sassStream = new stream.Readable()
+ sassStream.push(
+ data
+ .toString('utf8')
+ .replace(/\.\//g, 'scss/')
+ .replace(/^((.|\n)+)(\n\/\*\sModules(.|\n)+)(\n\/\*\sVariables(.|\n)+)/g, '$1$5$3')
+ )
+ sassStream.push(null)
+ sassStream.pipe(tachyonsSCSS)
+});

0 comments on commit 2cf15e1

Please sign in to comment.