This repository has been archived by the owner on Nov 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
164 additions
and
0 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,11 @@ | ||
# `@wpmudev/builder` | ||
|
||
> TODO: description | ||
## Usage | ||
|
||
``` | ||
const builder = require('@wpmudev/builder'); | ||
// TODO: DEMONSTRATE API | ||
``` |
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,7 @@ | ||
'use strict'; | ||
|
||
const builder = require('..'); | ||
|
||
describe('@wpmudev/builder', () => { | ||
it('needs tests'); | ||
}); |
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,89 @@ | ||
#!/usr/bin/env node | ||
|
||
/** | ||
* Supported Packages | ||
* List here all dependencies necessary to run required tasks. | ||
* | ||
* @since 0.0.0 | ||
*/ | ||
const path = require('path'); | ||
const gulp = require('gulp'); | ||
const rename = require('gulp-rename'); | ||
const sass = require('gulp-sass')(require('sass')); | ||
const cleanCSS = require('gulp-clean-css'); | ||
const autoprefixer = require('gulp-autoprefixer'); | ||
const header = require('gulp-header'); | ||
const prettier = require('gulp-prettier'); | ||
|
||
/** | ||
* Development Paths & Files | ||
* | ||
* @since 0.0.0 | ||
*/ | ||
|
||
const currentWorkingPath = process.cwd(); | ||
const { src, name } = require(path.join(currentWorkingPath, 'package.json')); | ||
|
||
const inputPath = path.join(currentWorkingPath, src); | ||
const packageName = name; | ||
const fileName = name.replace('@wpmudev/', ''); | ||
|
||
/** | ||
* WPMU DEV Banner | ||
* Print this on SUI scripts. | ||
* | ||
* @since 0.0.0 | ||
*/ | ||
const banner = [ | ||
'/*!', | ||
' * WPMU DEV Shared UI', | ||
`${fileName !== 'sui-css' ? ' * CSS Framework (' + fileName + ')' : ''}`, | ||
' * ', | ||
' * Copyright 2018 - 2022 Incsub (https://incsub.com)', | ||
' * Licensed under GPL-3.0 (http://www.gnu.org/licenses/gpl-3.0.html)', | ||
' */', | ||
'', | ||
].join('\n'); | ||
|
||
/** | ||
* List of Supported Browsers | ||
* | ||
* @since 0.0.0 | ||
*/ | ||
const browsersList = ['last 2 version', '> 1%']; | ||
|
||
/** | ||
* Compiling tasks. | ||
* Compile files and copy to dist folder. | ||
* | ||
* @since 0.0.0 | ||
*/ | ||
function compile() { | ||
return gulp | ||
.src(inputPath) | ||
.pipe(prettier()) | ||
.pipe(gulp.dest('src/')) | ||
.pipe(sass({ outputStyle: 'expanded' }).on('error', sass.logError)) | ||
.pipe(autoprefixer(browsersList)) | ||
.pipe(header(banner)) | ||
.pipe(prettier()) | ||
.pipe(gulp.dest('dist/')) | ||
.pipe(cleanCSS()) | ||
.pipe(rename({ suffix: '.min' })) | ||
.pipe(gulp.dest('dist/')) | ||
.on('finish', function () { | ||
console.log('📦 Package ' + packageName + ' compiled.'); | ||
}); | ||
} | ||
|
||
/** | ||
* Run tasks. | ||
* Use Gulp to run compiling tasks. | ||
* | ||
* @since 0.0.0 | ||
*/ | ||
gulp.task('build', compile); | ||
|
||
const build = gulp.task('build'); | ||
|
||
build(); |
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,57 @@ | ||
{ | ||
"name": "@wpmudev/builder", | ||
"version": "0.0.0", | ||
"private": true, | ||
"description": "This builder helps you compile SASS into CSS and minify it.", | ||
"keywords": [ | ||
"incsub", | ||
"wpmudev", | ||
"shared-ui", | ||
"css-builder" | ||
], | ||
"author": "WPMU DEV (https://wpmudev.com)", | ||
"contributors": [ | ||
{ | ||
"name": "Leighton Sapir", | ||
"email": "[email protected]", | ||
"url": "https://iamleigh.com" | ||
} | ||
], | ||
"license": "GPL-3.0", | ||
"main": "lib/builder.js", | ||
"directories": { | ||
"lib": "lib", | ||
"test": "__tests__" | ||
}, | ||
"files": [ | ||
"lib" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/wpmudev/sui-docs.git", | ||
"directory": "packages/builder" | ||
}, | ||
"bin": { | ||
"css-builder": "./lib/builder.js" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: run tests from root\" && exit 1" | ||
}, | ||
"bugs": { | ||
"url": "https://incsub.atlassian.net/browse/SUI" | ||
}, | ||
"homepage": "https://github.com/wpmudev/sui-docs#readme", | ||
"devDependencies": { | ||
"gulp": "^4.0.2", | ||
"gulp-autoprefixer": "^8.0.0", | ||
"gulp-clean-css": "^4.3.0", | ||
"gulp-header": "^2.0.9", | ||
"gulp-prettier": "^4.0.0", | ||
"gulp-rename": "^2.0.0", | ||
"gulp-sass": "^5.1.0", | ||
"sass": "^1.56.1" | ||
} | ||
} |