Giter Club home page Giter Club logo

Comments (6)

KittyGiraudel avatar KittyGiraudel commented on May 21, 2024

I am not sure what's the best way to tackle this one.

Could @requires need a type argument (mixin/function/variable)?

// @requires {mixin} base
// @requires {function} thing
// @requires {var} some-global-variable 

Any input, @valeriangalliat?

from sassdoc.

alademann avatar alademann commented on May 21, 2024

I'm not sure - I mean, on one hand - its probably not a good idea to have mixins and functions sharing names in your code base, but as a documentation tool - I'm not sure if its valid to be opinionated about best practices - so maybe the type argument would be optional @hugogiraudel ?

My comment assumes, @danielguillan, that what you're having an issue with is that in addition to the Sass you posted in your comment, you also have a function named base?

Eg.

@mixin base {
    @content;
}

@function base() {
    @return foo;
}

// Requires base
// ---
// @requires base
@mixin requires-base {
    @content;
}

Is this a complete demonstration of what our Sass contains that is causing the bug?

from sassdoc.

valeriangalliat avatar valeriangalliat commented on May 21, 2024

I was about to say the exact same thing as @alademann - make the type optional, and add a warning when there is no type and a name conflict between a function/mixin/var.

from sassdoc.

KittyGiraudel avatar KittyGiraudel commented on May 21, 2024

My comment assumes, @danielguillan, that what you're having an issue with is that in addition to the Sass you posted in your comment, you also have a function named base?

Nope, as of today, if you use @requires on a mixin, it will try to fetch a function, and vice versa. Not sure why it works this way though.

from sassdoc.

KittyGiraudel avatar KittyGiraudel commented on May 21, 2024

Agreed on having optional type.

from sassdoc.

KittyGiraudel avatar KittyGiraudel commented on May 21, 2024

Okay, it should now be fixed in both master and real-parser branches.

Basically the idea is the following one: when parsing a @requires flag, if there is a type given, we store it. Then once we're done parsing everything, the same way we deal with aliases, we post treat data to fill missing informations.

In this case, for each item with at least a require, and in the case where the type has not been given obviously, we find the type of the first item named after the value of the require flag, and store it.

from sassdoc.

Related Issues (20)

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.