Skip to content

Doesn't work as expected #1

@schel4ok

Description

@schel4ok
mix.js('resources/js/app.js', 'public/js')
   .postCss('resources/css/app.css', 'public/css', [
      require('postcss-import'), 
      require('postcss-svg'),
      require('postcss-mixins'),
      require('postcss-each-variables'),
      require('postcss-extend'),
      require('postcss-nested'),
      require('tailwindcss'),     
      require('autoprefixer'),
    ]);

I have this in input css file

:root {
	--icons: (
		check:				url("../views/components/svg/listicons.svg#check"),
		check-rounded: 		url("../views/components/svg/listicons.svg#check-rounded"),
		check-squared: 		url("../views/components/svg/listicons.svg#check-squared"),
		checklist: 			url("../views/components/svg/listicons.svg#checklist"),
		chevron: 			url("../views/components/svg/listicons.svg#chevron"),
		thumb-up-outline: 	url("../views/components/svg/listicons.svg#thumb-up-outline"),
		thumb-up-solid: 	url("../views/components/svg/listicons.svg#thumb-up-solid"),
		tools: 				url("../views/components/svg/listicons.svg#tools")
	);
}


@each $key, $value in var(--icons) {
	.svg-list-$(key) {
		content: $(value);
	}
}

And I have following output

:root {
  --icons: (
		check:				url(/images/listicons.svg?2a63c466cf4a3dc372356d34ce53757d#check),
		check-rounded: 		url(/images/listicons.svg?2a63c466cf4a3dc372356d34ce53757d#check-rounded),
		check-squared: 		url(/images/listicons.svg?2a63c466cf4a3dc372356d34ce53757d#check-squared),
		checklist: 			url(/images/listicons.svg?2a63c466cf4a3dc372356d34ce53757d#checklist),
		chevron: 			url(/images/listicons.svg?2a63c466cf4a3dc372356d34ce53757d#chevron),
		thumb-up-outline: 	url(/images/listicons.svg?2a63c466cf4a3dc372356d34ce53757d#thumb-up-outline),
		thumb-up-solid: 	url(/images/listicons.svg?2a63c466cf4a3dc372356d34ce53757d#thumb-up-solid),
		tools: 				url(/images/listicons.svg?2a63c466cf4a3dc372356d34ce53757d#tools)
	);
}

@each $key, $value in (check,check-rounded,check-squared,checklist,chevron,thumb-up-outline,thumb-up-solid,tools), (url("../views/components/svg/listicons.svg#check"),url("../views/components/svg/listicons.svg#check-rounded"),url("../views/components/svg/listicons.svg#check-squared"),url("../views/components/svg/listicons.svg#checklist"),url("../views/components/svg/listicons.svg#chevron"),url("../views/components/svg/listicons.svg#thumb-up-outline"),url("../views/components/svg/listicons.svg#thumb-up-solid"),url("../views/components/svg/listicons.svg#tools")) {
  .svg-list-$(key) {
    content: $(value);
  }
}

To me it seems like @each loop didn't launched. I expected to have 8 separate styles on the output from .svg-list-check to .svg-list-tools. What is wrong with my code?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions