Last active
March 17, 2016 05:16
-
-
Save MeoMix/393c04470ea83fd563d7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.blue { | |
background-color: rgb(66, 133, 244); | |
} | |
/* https://www.google.com/design/spec/components/buttons.html#buttons-raised-buttons */ | |
.disabledButton--dark { | |
background-color: rgba(255, 255, 255, .12); | |
} | |
/* | |
http://www.google.com/design/spec/components/buttons.html#buttons-flat-raised-buttons | |
Pressed: 40% #999999 or rgba(153, 153, 153, .4) | |
Hover: value is derived from spec. screenshot, alpha is 20% instead of 40% | |
*/ | |
.gray--hoverButton { | |
background-color: rgba(153, 153, 153, .2); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cssModulesPlugins from 'jspm-loader-css/src/plugins.js' | |
import Loader from 'jspm-loader-css/src/loader.js' | |
import postcssPlugins from './postcssPlugins.js'; | |
import conditionals from 'postcss-conditionals'; | |
export const { fetch, bundle } = new Loader(postcssPlugins.concat([ | |
conditionals(), | |
cssModulesPlugins.localByDefault, | |
cssModulesPlugins.extractImports, | |
cssModulesPlugins.scope | |
])); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import path from 'path'; | |
import mixins from 'postcss-mixins'; | |
import nesting from 'postcss-nesting'; | |
import mixinFrom from 'postcss-mixin-from'; | |
import inlineTrait from 'postcss-inline-trait'; | |
const isBundling = typeof window === 'undefined'; | |
const traitPath = 'common/css/traits/'; | |
// TODO: This still feels overly messy to me. I feel like this work should be handled by normalize if I could only express it correctly. | |
// Resolve relative directory path and drop the perceived 'root' of the generated path. | |
// The root value is incorrect as it doesn't take into account System.baseURL. | |
// The resulting path will be fed into SystemJS for propert, full resolution. | |
const getResolvedFilePath = (filePath, relativeToPath) => { | |
let resolvedFilePath = filePath; | |
if (isBundling && filePath[0] === '.') { | |
resolvedFilePath = path.resolve(relativeToPath, filePath); | |
// css.source.input.from is incorrect when building. Need to convert from relative and then drop root | |
// so that when giving the path to SystemJS' fetch it works as expected. | |
resolvedFilePath = resolvedFilePath.replace(path.parse(resolvedFilePath).root, ''); | |
} | |
return resolvedFilePath; | |
}; | |
// Helper function given to PostCSS plugins. Used to retrieve CSS from other files without | |
// coupling the PostCSS plugin to a specific environment. | |
const getFileText = (filePath, relativeToPath) => { | |
// relativeToPath references a file not a directory. Call path.dirname to strip the file. | |
const resolvedFilePath = getResolvedFilePath(filePath, path.dirname(relativeToPath)); | |
const canonicalParent = relativeToPath.replace(/^\//, ''); | |
return System | |
.normalize(resolvedFilePath, `${System.baseURL}${canonicalParent}`) | |
.then(System.import.bind(System)); | |
}; | |
export default [ | |
inlineTrait({ | |
getFileText, | |
traitPath | |
}), | |
mixinFrom({ | |
getFileText | |
}), | |
mixins, | |
nesting() | |
}) | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment