Issue #2672💬 AnsweredOpened March 20, 2020by alimurad522 reactions

Vendor prefix getting removed when getting css from getCss()

快速解答by artf1

Use this https://github.com/artf/grapesjs-parser-postcss

Read full answer below ↓

Question

I am using the version: 0.14.57 with React 16.8.6.

When I use the function editor.getCss() it returns me the css but without the vendor prefix. For example, I add the following css .product-card { -webkit-transition: all 0.2s ease; transition: all 0.2s ease; } it returns me .product-card{ transition-duration:0.2s; transition-timing-function:ease; transition-delay:0s; transition-property:all; }. How can I avoid this behaviour and get what I am saving (with the prefix)? I checked this in the demo, it works fine there but with my local I am having an issue. Unfortunately I can't publish it else where and don't have it live atm. It's just this one, getCss() function that's causing the issue. Following is my initialization:

let editor = GrapesJs.init({
	container: "#gjs",
	fromElement: true,
	plugins: [
	'gjs-blocks-basic',
	tUIImageEditor,
	GrapeJSFormPlugin,
	editor => FontAwesomePlugin(editor, {}),
	editor => SocialMediaPlugin(editor, {}),
	editor => VideoPlugin(editor, {})
	],
	canvas: {
		styles: [
		"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css",
		"https://fonts.googleapis.com/css?family=" + fontFamilies,
		"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.min.css"
		],
		scripts: [
		"https://code.jquery.com/jquery-3.3.1.slim.min.js",
		"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js",
		"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js",
		'https://use.fontawesome.com/145d2bb38b.js'
		]
	}
});

I'm applying the styles with editor.setStyles(css). It sets fine but when I retrieve it, it removes the prefix. Any help would be appreciated.

Answers (2)

alimurad52March 23, 2020

Worked like a charm @artf ! Thank you so much!

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.