@@ -81,39 +81,41 @@ class GridRowsColumns extends Declaration {
8181 if ( autoflow && ! processor . disabled ( autoflow , result ) ) {
8282 autoflowValue = autoflow . value . trim ( )
8383 }
84-
85- /**
86- * Show warning if grid-template-rows decl is not found
87- */
88- let rowDecl = parent . nodes . find ( i => i . prop === 'grid-template-rows' )
89-
90- if ( ! rowDecl && hasGridTemplate ) {
91- return undefined
92- } else if ( ! rowDecl && ! hasGridTemplate ) {
93- decl . warn (
94- result ,
95- `Autoplacement does not work without grid-template-rows property`
96- )
97- return undefined
98- }
99-
100- /**
101- * Show warning if grid-template-columns decl is not found
102- */
103- let columnDecl = parent . nodes . find ( i => i . prop === 'grid-template-columns' )
104- if ( ! columnDecl && ! hasGridTemplate ) {
105- decl . warn (
106- result ,
107- `Autoplacement does not work without grid-template-columns property`
108- )
109- }
110-
111- /**
112- * Autoplace grid items
113- */
114- let autoplaceEnabled = status === 'autoplace'
115- if ( isColumnProp && ! hasGridTemplate && autoplaceEnabled ) {
116- autoplaceGridItems ( decl , result , gap , autoflowValue )
84+ if ( status === 'autoplace' ) {
85+ /**
86+ * Show warning if grid-template-rows decl is not found
87+ */
88+ let rowDecl = parent . nodes . find ( i => i . prop === 'grid-template-rows' )
89+
90+ if ( ! rowDecl && hasGridTemplate ) {
91+ return undefined
92+ } else if ( ! rowDecl && ! hasGridTemplate ) {
93+ decl . warn (
94+ result ,
95+ `Autoplacement does not work without grid-template-rows property`
96+ )
97+ return undefined
98+ }
99+
100+ /**
101+ * Show warning if grid-template-columns decl is not found
102+ */
103+ let columnDecl = parent . nodes . find ( i => {
104+ return i . prop === 'grid-template-columns'
105+ } )
106+ if ( ! columnDecl && ! hasGridTemplate ) {
107+ decl . warn (
108+ result ,
109+ `Autoplacement does not work without grid-template-columns property`
110+ )
111+ }
112+
113+ /**
114+ * Autoplace grid items
115+ */
116+ if ( isColumnProp && ! hasGridTemplate ) {
117+ autoplaceGridItems ( decl , result , gap , autoflowValue )
118+ }
117119 }
118120
119121 return undefined
0 commit comments