This is easily way for add css for group cms pages Try this :-
Please follow below steps to add css and js to specific cms page using custom module.
- Create custom module using below step
app/code/Mage/Mohit/registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Mage_Mohit',
__DIR__
);
app/code/VendorMage/ModuleMohit/etc/module.xml
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Mage_Mohit" setup_version="1.0.0"/>
</config>
app/code/VendorMage/ModuleMohit/view/frontend/web/css/custom.css.Then add your css code into custom.css
file
And goto your admin panel and open you want to add css page.
- GOTO ADMIN -> Content -> Pages -> Edit page -> Design -> Layout Update XML and add below code for particulate page.
<head>
<css src="Mage_Mohit::css/custom.css"/>
</head>
For the other cms page create specific css file and add app/code/Mage/Mohit/view/frontend/web/css/
and add that css file into other cms page same as step2 via just changing css file name.
And add more css file this path app/code/Mage/Mohit/view/frontend/web/css
and call this type
<head>
<css src="Mage_Mohit::css/more.css"/>
</head>
Hope help you
Thanks ...