How to configure Magento 2 Theme/Design via the Command-Line?
I'm doing some server configuration related tasks and was looking for a way to configure the theme of a store/website via the command-line.
I'm setting up a store with a custom theme (e.g. "Vendor/code
") and I would like to activate it without entering the adminhtml website but set the theme on the command-line / in the shell / bash script.
magento2 theme configuration cli linux
add a comment |
I'm doing some server configuration related tasks and was looking for a way to configure the theme of a store/website via the command-line.
I'm setting up a store with a custom theme (e.g. "Vendor/code
") and I would like to activate it without entering the adminhtml website but set the theme on the command-line / in the shell / bash script.
magento2 theme configuration cli linux
Created custom theme, you want to set for store ?
– Suresh Chikani
Oct 24 '16 at 10:19
@SHPatel: Yes, created a custom theme and then doing semi/automated deployments. Edited the question to reflect this better and have a bit more context.
– hakre
Oct 24 '16 at 11:07
add a comment |
I'm doing some server configuration related tasks and was looking for a way to configure the theme of a store/website via the command-line.
I'm setting up a store with a custom theme (e.g. "Vendor/code
") and I would like to activate it without entering the adminhtml website but set the theme on the command-line / in the shell / bash script.
magento2 theme configuration cli linux
I'm doing some server configuration related tasks and was looking for a way to configure the theme of a store/website via the command-line.
I'm setting up a store with a custom theme (e.g. "Vendor/code
") and I would like to activate it without entering the adminhtml website but set the theme on the command-line / in the shell / bash script.
magento2 theme configuration cli linux
magento2 theme configuration cli linux
edited 1 hour ago
Himanshu
930521
930521
asked Oct 24 '16 at 10:18
hakrehakre
1,40221435
1,40221435
Created custom theme, you want to set for store ?
– Suresh Chikani
Oct 24 '16 at 10:19
@SHPatel: Yes, created a custom theme and then doing semi/automated deployments. Edited the question to reflect this better and have a bit more context.
– hakre
Oct 24 '16 at 11:07
add a comment |
Created custom theme, you want to set for store ?
– Suresh Chikani
Oct 24 '16 at 10:19
@SHPatel: Yes, created a custom theme and then doing semi/automated deployments. Edited the question to reflect this better and have a bit more context.
– hakre
Oct 24 '16 at 11:07
Created custom theme, you want to set for store ?
– Suresh Chikani
Oct 24 '16 at 10:19
Created custom theme, you want to set for store ?
– Suresh Chikani
Oct 24 '16 at 10:19
@SHPatel: Yes, created a custom theme and then doing semi/automated deployments. Edited the question to reflect this better and have a bit more context.
– hakre
Oct 24 '16 at 11:07
@SHPatel: Yes, created a custom theme and then doing semi/automated deployments. Edited the question to reflect this better and have a bit more context.
– hakre
Oct 24 '16 at 11:07
add a comment |
2 Answers
2
active
oldest
votes
I was not able to find a direct Magento CLI command so far, I could work around with a Bash and Magerun:
$ THEME_ID="$(n98-magerun2.phar dev:theme:list --format=csv
| grep 'Vendor/code' | cut -d, -f1)"
; test -n "${THEME_ID}"
&& n98-magerun2.phar config:set design/theme/theme_id "${THEME_ID}"
This sequence sets the configuration path for the theme_id to the one of the named theme (by it's code, which is "Vendor/code
" in the example).
In case the operation fails, this has a non-zero status.
add a comment |
The only command related to themes out of the box in Magento 2 is php bin/magento theme:uninstall
which can be used to uninstall a theme.
I suggest you create your own command following the example in the sample module so you can develop your custom code to configure themes properly.
Also I suggest you read the official documentation to create your own command: http://devdocs.magento.com/guides/v2.0/extension-dev-guide/cli-cmds/cli-howto.html
I would consider creating a CLI command off-topic in the light of an answer (yes it's possible, and programming it yourself is always the solution of everything, and so its kinda superfluous for an answer here) - and consider that more a comment. But thanks for your efforts and your commentary.
– hakre
Oct 24 '16 at 10:25
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f142315%2fhow-to-configure-magento-2-theme-design-via-the-command-line%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I was not able to find a direct Magento CLI command so far, I could work around with a Bash and Magerun:
$ THEME_ID="$(n98-magerun2.phar dev:theme:list --format=csv
| grep 'Vendor/code' | cut -d, -f1)"
; test -n "${THEME_ID}"
&& n98-magerun2.phar config:set design/theme/theme_id "${THEME_ID}"
This sequence sets the configuration path for the theme_id to the one of the named theme (by it's code, which is "Vendor/code
" in the example).
In case the operation fails, this has a non-zero status.
add a comment |
I was not able to find a direct Magento CLI command so far, I could work around with a Bash and Magerun:
$ THEME_ID="$(n98-magerun2.phar dev:theme:list --format=csv
| grep 'Vendor/code' | cut -d, -f1)"
; test -n "${THEME_ID}"
&& n98-magerun2.phar config:set design/theme/theme_id "${THEME_ID}"
This sequence sets the configuration path for the theme_id to the one of the named theme (by it's code, which is "Vendor/code
" in the example).
In case the operation fails, this has a non-zero status.
add a comment |
I was not able to find a direct Magento CLI command so far, I could work around with a Bash and Magerun:
$ THEME_ID="$(n98-magerun2.phar dev:theme:list --format=csv
| grep 'Vendor/code' | cut -d, -f1)"
; test -n "${THEME_ID}"
&& n98-magerun2.phar config:set design/theme/theme_id "${THEME_ID}"
This sequence sets the configuration path for the theme_id to the one of the named theme (by it's code, which is "Vendor/code
" in the example).
In case the operation fails, this has a non-zero status.
I was not able to find a direct Magento CLI command so far, I could work around with a Bash and Magerun:
$ THEME_ID="$(n98-magerun2.phar dev:theme:list --format=csv
| grep 'Vendor/code' | cut -d, -f1)"
; test -n "${THEME_ID}"
&& n98-magerun2.phar config:set design/theme/theme_id "${THEME_ID}"
This sequence sets the configuration path for the theme_id to the one of the named theme (by it's code, which is "Vendor/code
" in the example).
In case the operation fails, this has a non-zero status.
answered Oct 24 '16 at 10:22
hakrehakre
1,40221435
1,40221435
add a comment |
add a comment |
The only command related to themes out of the box in Magento 2 is php bin/magento theme:uninstall
which can be used to uninstall a theme.
I suggest you create your own command following the example in the sample module so you can develop your custom code to configure themes properly.
Also I suggest you read the official documentation to create your own command: http://devdocs.magento.com/guides/v2.0/extension-dev-guide/cli-cmds/cli-howto.html
I would consider creating a CLI command off-topic in the light of an answer (yes it's possible, and programming it yourself is always the solution of everything, and so its kinda superfluous for an answer here) - and consider that more a comment. But thanks for your efforts and your commentary.
– hakre
Oct 24 '16 at 10:25
add a comment |
The only command related to themes out of the box in Magento 2 is php bin/magento theme:uninstall
which can be used to uninstall a theme.
I suggest you create your own command following the example in the sample module so you can develop your custom code to configure themes properly.
Also I suggest you read the official documentation to create your own command: http://devdocs.magento.com/guides/v2.0/extension-dev-guide/cli-cmds/cli-howto.html
I would consider creating a CLI command off-topic in the light of an answer (yes it's possible, and programming it yourself is always the solution of everything, and so its kinda superfluous for an answer here) - and consider that more a comment. But thanks for your efforts and your commentary.
– hakre
Oct 24 '16 at 10:25
add a comment |
The only command related to themes out of the box in Magento 2 is php bin/magento theme:uninstall
which can be used to uninstall a theme.
I suggest you create your own command following the example in the sample module so you can develop your custom code to configure themes properly.
Also I suggest you read the official documentation to create your own command: http://devdocs.magento.com/guides/v2.0/extension-dev-guide/cli-cmds/cli-howto.html
The only command related to themes out of the box in Magento 2 is php bin/magento theme:uninstall
which can be used to uninstall a theme.
I suggest you create your own command following the example in the sample module so you can develop your custom code to configure themes properly.
Also I suggest you read the official documentation to create your own command: http://devdocs.magento.com/guides/v2.0/extension-dev-guide/cli-cmds/cli-howto.html
answered Oct 24 '16 at 10:22
Raphael at Digital PianismRaphael at Digital Pianism
54k21118273
54k21118273
I would consider creating a CLI command off-topic in the light of an answer (yes it's possible, and programming it yourself is always the solution of everything, and so its kinda superfluous for an answer here) - and consider that more a comment. But thanks for your efforts and your commentary.
– hakre
Oct 24 '16 at 10:25
add a comment |
I would consider creating a CLI command off-topic in the light of an answer (yes it's possible, and programming it yourself is always the solution of everything, and so its kinda superfluous for an answer here) - and consider that more a comment. But thanks for your efforts and your commentary.
– hakre
Oct 24 '16 at 10:25
I would consider creating a CLI command off-topic in the light of an answer (yes it's possible, and programming it yourself is always the solution of everything, and so its kinda superfluous for an answer here) - and consider that more a comment. But thanks for your efforts and your commentary.
– hakre
Oct 24 '16 at 10:25
I would consider creating a CLI command off-topic in the light of an answer (yes it's possible, and programming it yourself is always the solution of everything, and so its kinda superfluous for an answer here) - and consider that more a comment. But thanks for your efforts and your commentary.
– hakre
Oct 24 '16 at 10:25
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f142315%2fhow-to-configure-magento-2-theme-design-via-the-command-line%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Created custom theme, you want to set for store ?
– Suresh Chikani
Oct 24 '16 at 10:19
@SHPatel: Yes, created a custom theme and then doing semi/automated deployments. Edited the question to reflect this better and have a bit more context.
– hakre
Oct 24 '16 at 11:07