-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(*): initial commit of less plugin (should be working)
- Loading branch information
Showing
10 changed files
with
160 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/node_modules | ||
.idea | ||
.vscode | ||
npm-debug.log* | ||
/typings | ||
/dist |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/typings | ||
/.vscode |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
sudo: false | ||
language: node_js | ||
cache: | ||
directories: | ||
- node_modules | ||
notifications: | ||
email: false | ||
node_js: | ||
- 6 | ||
before_install: | ||
- npm i -g npm | ||
before_script: | ||
- npm prune | ||
- npm install @easy-webpack/core webpack@beta | ||
after_success: | ||
- npm run semantic-release | ||
branches: | ||
except: | ||
- /^v\d+\.\d+\.\d+$/ |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"name": "@easy-webpack/config-less", | ||
"description": "Easy Webpack configuration module for using Less in your Webpack applications.", | ||
"main": "dist/index.js", | ||
"typings": "dist/index.d.ts", | ||
"scripts": { | ||
"test": "TS_NODE_FAST=true TS_NODE_NO_PROJECT=true ava", | ||
"prepublish": "typings install", | ||
"build": "rimraf dist && tsc -p .", | ||
"semantic-release": "npm run build && semantic-release pre && npm publish --access=public && semantic-release post" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/easy-webpack/config-less.git" | ||
}, | ||
"keywords": [ | ||
"css", | ||
"webpack", | ||
"easy", | ||
"configurator", | ||
"configuration", | ||
"config", | ||
"simple" | ||
], | ||
"author": "Dwayne Charrington <dwaynecharrington@gmail.com> (http://ilikekillnerds.com)", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/easy-webpack/config-less/issues" | ||
}, | ||
"homepage": "https://github.com/easy-webpack/config-less#readme", | ||
"devDependencies": { | ||
"ava": "^0.15.2", | ||
"semantic-release": "^4.3.5", | ||
"ts-node": "^0.9.1", | ||
"tslint": "^3.11.0", | ||
"tslint-config-standard": "^1.2.2", | ||
"typescript": ">=1.9.0-dev.20160619-1.0 || ^2.0.0", | ||
"typings": "^1.3.0" | ||
}, | ||
"dependencies": { | ||
"css-loader": "^0.23.1", | ||
"extract-text-webpack-plugin": "^1.0.1", | ||
"less-loader": "^2.2.3", | ||
"style-loader": "^0.13.1" | ||
}, | ||
"peerDependencies": { | ||
"@easy-webpack/core": "*" | ||
}, | ||
"ava": { | ||
"files": [ | ||
"test/**/*.{ts,js}" | ||
], | ||
"tap": false, | ||
"require": [ | ||
"ts-node/register" | ||
] | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {WebpackConfig, get} from '@easy-webpack/core' | ||
const ExtractTextPlugin = require('extract-text-webpack-plugin') | ||
|
||
/** | ||
* CSS loader support for *.less | ||
* @param sourceMap enable generating source maps (slower build) | ||
* @param extractCss leave empty to skip extracting CSS or define an object with filename and optionally allChunks (boolean) | ||
*/ | ||
export = function less(extractCss = { filename: '[name].css', allChunks: false, sourceMap: false }) { | ||
return function less(this: WebpackConfig): WebpackConfig { | ||
const extractCSSinstance = extractCss ? new ExtractTextPlugin(extractCss.filename || '[name].css', extractCss) : null | ||
const cssLoader = `css${extractCss.sourceMap ? '?sourceMap!less' : '!less'}` | ||
const config = { | ||
module: { | ||
loaders: get(this, 'module.loaders', []).concat([{ | ||
test: /\.less$/i, | ||
loaders: extractCss ? extractCSSinstance.extract('style', cssLoader) : ['style', cssLoader] | ||
}]) | ||
} | ||
} as WebpackConfig | ||
if (extractCSSinstance) { | ||
config.plugins = [ | ||
/** | ||
* Plugin: ExtractTextPlugin | ||
* It moves every import "style.css" in entry chunks into a single concatenated css output file. | ||
* So your styles are no longer inlined into the javascript, but separate in a css bundle file (styles.css). | ||
* If your total stylesheet volume is big, it will be faster because the stylesheet bundle is loaded in parallel to the javascript bundle. | ||
*/ | ||
extractCSSinstance | ||
].concat(get(this, 'plugins', [])) | ||
} | ||
return config | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import test from 'ava' | ||
import {assign} from '../src' | ||
|
||
test(`dummy`, t => { | ||
t.true(true) | ||
}) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"module": "commonjs", | ||
"experimentalDecorators": true, | ||
"moduleResolution": "node", | ||
"allowJs": false, | ||
"declaration": true, | ||
"outDir": "dist", | ||
"rootDir": "src", | ||
"sourceMap": true, | ||
"lib": ["es6"] | ||
}, | ||
"exclude": [ | ||
"node_modules", | ||
"dist", | ||
"test", | ||
"example" | ||
] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "tslint-config-standard" | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"dependencies": { | ||
"debug": "registry:npm/debug#2.0.0+20160511151334", | ||
"lodash": "registry:npm/lodash#4.0.0+20160416211519" | ||
}, | ||
"globalDependencies": { | ||
"node": "registry:env/node#6.0.0+20160610031852" | ||
} | ||
} |