Sha256: 18f7d2de48349b494dcfbdf47ecb2f17b11b7baa2d84d9feca388dd3be5093a3

Contents?: true

Size: 1.48 KB

Versions: 17

Compression:

Stored size: 1.48 KB

Contents

#include "remove_placeholders.hpp"
#include "context.hpp"
#include "inspect.hpp"
#include "to_string.hpp"
#include <iostream>

namespace Sass {

    Remove_Placeholders::Remove_Placeholders(Context& ctx)
    : ctx(ctx)
    { }

    template<typename T>
    void Remove_Placeholders::clean_selector_list(T r) {

        // Create a new selector group without placeholders
        Selector_List* sl = static_cast<Selector_List*>(r->selector());

        if (sl) {
            Selector_List* new_sl = new (ctx.mem) Selector_List(sl->pstate());

            for (size_t i = 0, L = sl->length(); i < L; ++i) {
                if (!(*sl)[i]->has_placeholder()) {
                    *new_sl << (*sl)[i];
                }
            }

            // Set the new placeholder selector list
            r->selector(new_sl);
        }

        // Iterate into child blocks
        Block* b = r->block();

        for (size_t i = 0, L = b->length(); i < L; ++i) {
            Statement* stm = (*b)[i];
            stm->perform(this);
        }
    }

    void Remove_Placeholders::operator()(Block* b) {
        for (size_t i = 0, L = b->length(); i < L; ++i) {
            (*b)[i]->perform(this);
        }
    }

    void Remove_Placeholders::operator()(Ruleset* r) {
        clean_selector_list(r);
    }

    void Remove_Placeholders::operator()(Media_Block* m) {
        clean_selector_list(m);
    }

    void Remove_Placeholders::operator()(At_Rule* a) {
        if (a->block()) a->block()->perform(this);
    }

}

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
gulp_assets-1.0.0.pre.5 template/node_modules/gulp-sass/node_modules/node-sass/src/libsass/remove_placeholders.cpp
gulp_assets-1.0.0.pre.4 template/node_modules/gulp-sass/node_modules/node-sass/src/libsass/remove_placeholders.cpp
gulp_assets-1.0.0.pre.3 template/node_modules/gulp-sass/node_modules/node-sass/src/libsass/remove_placeholders.cpp
sassc-1.7.1 ext/libsass/remove_placeholders.cpp
sassc-1.7.0 ext/libsass/remove_placeholders.cpp
sassc-1.6.0 ext/libsass/remove_placeholders.cpp
sassc-1.5.1 ext/libsass/remove_placeholders.cpp
sassc-1.5.0 ext/libsass/remove_placeholders.cpp
sassc-1.4.0 ext/libsass/remove_placeholders.cpp
sassc-1.3.0 ext/libsass/remove_placeholders.cpp
sassc-1.2.0 ext/libsass/remove_placeholders.cpp
sassc-1.1.2 ext/libsass/remove_placeholders.cpp
sassc-1.1.1 ext/libsass/remove_placeholders.cpp
sassc-1.1.0 ext/libsass/remove_placeholders.cpp
sassc-1.0.0 ext/libsass/remove_placeholders.cpp
sassc-0.0.11 ext/libsass/remove_placeholders.cpp
sassc-0.0.10 ext/libsass/remove_placeholders.cpp