Sha256: cb8d8a7b851d82230ec4dfb22567e84f9505da6432b0e1ba71a4ec458201dc38
Contents?: true
Size: 1.47 KB
Versions: 6
Compression:
Stored size: 1.47 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) { } 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) { // Create a new selector group without placeholders Selector_List* sl = static_cast<Selector_List*>(r->selector()); if (sl) { Selector_List* new_sl = SASS_MEMORY_NEW(ctx.mem, Selector_List, sl->pstate()); for (size_t i = 0, L = sl->length(); i < L; ++i) { if (!(*sl)[i]->contains_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) { if ((*b)[i]) (*b)[i]->perform(this); } } void Remove_Placeholders::operator()(Media_Block* m) { Block* b = m->block(); for (size_t i = 0, L = b->length(); i < L; ++i) { if ((*b)[i]) (*b)[i]->perform(this); } } void Remove_Placeholders::operator()(At_Rule* a) { if (a->block()) a->block()->perform(this); } }
Version data entries
6 entries across 6 versions & 1 rubygems