Include CSS in Site from Package


(David Lang) #1

Hey, I have a Neos Site. Now I created a Package to extend the existing Site with some additional functions. For this new functions I need to add a css file to the site. For example:

Additional.Package -> add css file to the Site which is generated by the Main.Package.

At the Moment I have the following code:

Main.Package:

prototype(TYPO3.TypoScript:Template) < prototype(Neos.Fusion:Template) 

page = Page { 
	head { 
		meta = TYPO3.TypoScript:Template { 
     			templatePath = 'resource://Main.Package/Private/Templates/Page/Default.html' 
			    sectionName = 'meta' 
   		 }
    	stylesheets { }
  	} 
  	body {...

Additional.Package:

prototype(Neos.Neos:Page) {
	head {
		htmlTag = Neos.Fusion:Tag {
        		tagName = 'link'

        		attributes {
        			href = 'test.css'
               			type = 'text/css'
        		}
		}
	}
}

Hope someone can help me.


(Dominique Feyer) #2

htmlTag path is wrong … should be something like

prototype(Neos.Neos:Page) {
    head {
	stylesheets {
                additionatPackage = Neos.Fusion:Tag {
    		    tagName = 'link'
                    ...
                }
        }
    }
}

We create two small package with Fusion helper to include stylesheet or javascript


(David Lang) #3

Thanks for the answer @dfeyer .

That doesn’t work :frowning: . Could it be an Problem that the Main package is a “site package” (created with kickstart:site) and the additional Package (created with kickstart:package) is an application?

In the additional package I also defined some content elements and they are working fine. Just the css file is not included.

Do you have a full example for me? Just want to include a css file a cross two packages.


(Dominique Feyer) #4

An example code in the README of the package:

The package type (Site, Application, Plugin) should make no difference


(Daniel Kestler) #5

Make sure the loading order is correct by specifying composer requirements for the packages.