Coder Social home page Coder Social logo

robinck / gulp-style-aliases Goto Github PK

View Code? Open in Web Editor NEW
3.0 4.0 1.0 61 KB

Gulp plugin that lets you create custom aliases for CSS,less and SASS properties with an @alias rule πŸ‡ΊπŸ‡¦

Home Page: https://www.npmjs.com/package/gulp-style-aliases

License: MIT License

JavaScript 100.00%
gulp gulp-plugin aliases

gulp-style-aliases's Introduction

js-semistandard-styleBuild StatusCode ClimatenpmDependenciesdevDependenciesNPM version

gulp-style-aliases

Gulp plugin that lets you create custom aliases for CSS,less and SASS properties with an @alias rule. Supports @import '...' and url('...').

Install

$ npm install --save-dev gulp-style-aliases

Usage

const gulp = require('gulp');
const aliases = require('gulp-style-aliases');

var webPath = '.', outputPath = 'dest';

gulp.task('default', () =>
	gulp.src('src/*.{css|less|scss}')
		.pipe(aliases({
		    "@aliasName": "path/to/your/folder"
		}))
		.pipe(gulp.dest(outputPath))
);

A javascript file before compilation

@import "@aliasName/css/user.less";

body {
  background: #9e9e9e;
}

will become:

@import "path/to/your/folder/css/user.less";

body {
  background: #9e9e9e;
}

gulp-style-aliases's People

Contributors

robinck avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

bjcooper

gulp-style-aliases's Issues

Import an import from another file

Hi,

Im trying to import an import from another file, but it returns that the path is undefined.

Example:

/test/sources/sass/main.scss
@import 'anotherTest/main';

/test2/sources/sass/main.scss
@import 'test/main';

But when i try to compile test2 sass file, it returns that @import 'anotherTest/main'; is undefined even if i add the two aliases.

There's any way to solve this?

Thanks!

gulp-style-aliases not working in deep import directory in gulp

gulp.js

  .pipe(aliases({
        "approot": "src/static",
        "subroot": "bikedekhosrc/static"
    }))

dev.scss

@import "subroot/scss/components/headerfooter_Desktop"; // this is working fine

subroot/scss/components/headerfooter_Desktop

below code in this file

   @import "approot/components/headerfooter_Desktop"; // this code is not working  

   @import "src/static/components/headerfooter_Desktop"; // this code is working fine

    .header {
            background: red;
     }

The problem with @font-face

Hi.
I have a problem. The alias from the second url in font-face doesn't work. Like this:
// input

@font-face {
font-family:'Zawgyi-One';
src: local('Zawgyi-One'),
url('@aliasName/fonts/zawgyi.woff') format('woff'),
url('@aliasName/fonts/zawgyi.ttf') format('truetype');
font-style: normal;
font-weight: 400;
}

// output

@font-face {
font-family: 'Zawgyi-One';
src: local("Zawgyi-One"),
url("../fonts/zawgyi.woff") format("woff"),
url("@aliasName/fonts/zawgyi.ttf") format("truetype");
font-style: normal;
font-weight: 400;
}

What can be wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.