diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c380e58 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,34 @@ +# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs. +# Requires EditorConfig JetBrains Plugin - http://github.com/editorconfig/editorconfig-jetbrains + +# Set this file as the topmost .editorconfig +# (multiple files can be used, and are applied starting from current document location) +root = true + +[{package.json}] +indent_style = space +indent_size = 2 + +# Use bracketed regexp to target specific file types or file locations +[*.{js,json}] + +# Use hard or soft tabs ["tab", "space"] +indent_style = space + +# Size of a single indent [an integer, "tab"] +indent_size = tab + +# Number of columns representing a tab character [an integer] +tab_width = 4 + +# Line breaks representation ["lf", "cr", "crlf"] +end_of_line = lf + +# ["latin1", "utf-8", "utf-16be", "utf-16le"] +charset = utf-8 + +# Remove any whitespace characters preceding newline characters ["true", "false"] +trim_trailing_whitespace = true + +# Ensure file ends with a newline when saving ["true", "false"] +insert_final_newline = true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c209e54 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +node_modules +*.log +.DS_Store +lib +esdocs +coverage diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..a38661a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,9 @@ +sudo: required +language: node_js +node_js: + - 4.2 + - stable +before_script: + - npm run link +after_success: + - npm run build diff --git a/README.md b/README.md index 793394d..8d58f64 100644 --- a/README.md +++ b/README.md @@ -1 +1,5 @@ -# roc-plugin-style-sass \ No newline at end of file +# roc-plugin-style-sass +[![Build Status](https://travis-ci.org/rocjs/roc-plugin-style-sass.svg?branch=master)](https://travis-ci.org/rocjs/roc-plugin-style-sass) + +__Plugin providing Sass support for Webpack__ +- [roc-plugin-style-sass](/packages/roc-plugin-style-sass) diff --git a/package.json b/package.json new file mode 100644 index 0000000..cbcb321 --- /dev/null +++ b/package.json @@ -0,0 +1,15 @@ +{ + "name": "roc-plugin-style-sass", + "private": true, + "license": "MIT", + "scripts": { + "rid": "rid", + "build": "rid build", + "lint": "rid lint:alias", + "link": "rid link", + "test": "npm run lint" + }, + "devDependencies": { + "@rocjs/roc-internal-dev": "^1.0.0" + } +} diff --git a/packages/roc-plugin-style-sass/.eslintignore b/packages/roc-plugin-style-sass/.eslintignore new file mode 100644 index 0000000..bc73336 --- /dev/null +++ b/packages/roc-plugin-style-sass/.eslintignore @@ -0,0 +1,3 @@ +lib +esdocs +docs diff --git a/packages/roc-plugin-style-sass/.eslintrc b/packages/roc-plugin-style-sass/.eslintrc new file mode 100644 index 0000000..811e6a8 --- /dev/null +++ b/packages/roc-plugin-style-sass/.eslintrc @@ -0,0 +1,13 @@ +{ + "extends": "vgno", + + "parser": "babel-eslint", + + "env": { + "es6": true + }, + + "ecmaFeatures": { + "modules": true + } +} diff --git a/packages/roc-plugin-style-sass/README.md b/packages/roc-plugin-style-sass/README.md new file mode 100644 index 0000000..b28603a --- /dev/null +++ b/packages/roc-plugin-style-sass/README.md @@ -0,0 +1,8 @@ +# roc-plugin-style-sass +Plugin providing Sass support for Webpack. + +## Documentation +- [Actions](/packages/roc-plugin-style-sass/docs/Actions.md) +- [Commands](/packages/roc-plugin-style-sass/docs/Commands.md) +- [Hooks](/packages/roc-plugin-style-sass/docs/Hooks.md) +- [Settings](/packages/roc-plugin-style-sass/docs/Settings.md) diff --git a/packages/roc-plugin-style-sass/docs/Actions.md b/packages/roc-plugin-style-sass/docs/Actions.md new file mode 100644 index 0000000..f9157d8 --- /dev/null +++ b/packages/roc-plugin-style-sass/docs/Actions.md @@ -0,0 +1,14 @@ +# Actions for `roc-plugin-style-sass` + +## Actions +* [roc-plugin-style-sass](#roc-plugin-style-sass) + * [sass](#sass) + +## roc-plugin-style-sass + +### sass + +Adds Sass support to Webpack. + +__Connects to extension:__ `roc-plugin-style-css` +__Connects to hook:__ `add-style` diff --git a/packages/roc-plugin-style-sass/docs/Commands.md b/packages/roc-plugin-style-sass/docs/Commands.md new file mode 100644 index 0000000..bdd77ee --- /dev/null +++ b/packages/roc-plugin-style-sass/docs/Commands.md @@ -0,0 +1 @@ +No commands available. \ No newline at end of file diff --git a/packages/roc-plugin-style-sass/docs/Hooks.md b/packages/roc-plugin-style-sass/docs/Hooks.md new file mode 100644 index 0000000..8298515 --- /dev/null +++ b/packages/roc-plugin-style-sass/docs/Hooks.md @@ -0,0 +1 @@ +No hooks available. \ No newline at end of file diff --git a/packages/roc-plugin-style-sass/docs/Settings.md b/packages/roc-plugin-style-sass/docs/Settings.md new file mode 100644 index 0000000..3092331 --- /dev/null +++ b/packages/roc-plugin-style-sass/docs/Settings.md @@ -0,0 +1,9 @@ +# Settings for `roc-plugin-style-sass` + +## Build + +### Sass + +| Name | Description | Path | CLI option | Default | Type | Required | +| ---------- | -------------------------------------------------------------------------------------------------- | --------------------- | ----------------------- | ------- | --------- | -------- | +| useBourbon | If Bourbon should be made available to include easily with `@import "bourbon";`. | build.sass.useBourbon | --build-sass-useBourbon | `true` | `Boolean` | No | diff --git a/packages/roc-plugin-style-sass/package.json b/packages/roc-plugin-style-sass/package.json new file mode 100644 index 0000000..97efbaa --- /dev/null +++ b/packages/roc-plugin-style-sass/package.json @@ -0,0 +1,37 @@ +{ + "name": "roc-plugin-style-sass", + "version": "1.0.0-alpha.0", + "description": "Plugin providing Sass support for Webpack in Roc", + "main": "lib/index.js", + "scripts": { + "lint": "eslint .", + "test": "npm run lint" + }, + "files": [ + "lib" + ], + "keywords": [ + "roc", + "roc-package", + "webpack", + "roc-dev" + ], + "repository": { + "type": "git", + "url": "https://github.com/rocjs/roc-plugin-style-sass.git" + }, + "author": "VG", + "license": "MIT", + "dependencies": { + "bourbon": "~4.2.6", + "node-sass": "~3.4.2", + "roc": "^1.0.0-rc", + "sass-loader": "~3.1.2", + "webpack": "~1.12.14" + }, + "devDependencies": { + "babel-eslint": "~5.0.0", + "eslint": "~1.10.3", + "eslint-config-vgno": "~5.0.0" + } +} diff --git a/packages/roc-plugin-style-sass/roc.config.js b/packages/roc-plugin-style-sass/roc.config.js new file mode 100644 index 0000000..2d0a4b0 --- /dev/null +++ b/packages/roc-plugin-style-sass/roc.config.js @@ -0,0 +1,6 @@ +const path = require('path'); + +// Makes it possible for use to generate documentation for this package. +module.exports = { + packages: [path.join(__dirname, 'lib', 'index.js')] +}; diff --git a/packages/roc-plugin-style-sass/src/index.js b/packages/roc-plugin-style-sass/src/index.js new file mode 100644 index 0000000..e8e32b9 --- /dev/null +++ b/packages/roc-plugin-style-sass/src/index.js @@ -0,0 +1,46 @@ +import { isBoolean } from 'roc/validators'; + +export const roc = { + name: require('../package.json').name, + config: { + settings: { + build: { + sass: { + useBourbon: true + } + } + } + }, + meta: { + settings: { + descriptions: { + build: { + sass: { + useBourbon: 'If Bourbon should be made available to include easily with `@import "bourbon";`.' + } + } + }, + + validations: { + build: { + sass: { + useBourbon: isBoolean + } + } + } + } + }, + actions: { + sass: { + extension: 'roc-plugin-style-css', + hook: 'add-style', + description: 'Adds Sass support to Webpack.', + action: () => ({ settings }) => () => () => ({ + extensions: ['sass', 'scss'], + loaders: `${require.resolve('sass-loader')}?sourceMap${settings.build.sass.useBourbon ? + '&includePaths[]=' + require('bourbon').includePaths : '' + }` + }) + } + } +};