New rules may have scared away many restaurants, but this may be the beginning of better outdoor dining.
ByJustin Davidson,
New York Magazine’s architecture and classical-music critic since 2007 and was the recipient of the Pulitzer Prize for Criticism in 2002.
Photo: James Andrews/Shutterstock
Photo: James Andrews/Shutterstock
The signs of COVID City are fading. Tattered yellow decals on subway platforms sport a pair of footprints and the admonition to “keep a safe social distance from others,” a phrase that will grow more mysterious with each passing year. Some stores never bothered to take down signs requiring masks for entry. The last redoubts of pandemic architecture, the restaurant sheds made of plywood and two-by-fours that kept hardened New York diners eating out through all but the most frigid weeks, are finally coming down. In their place we’re getting a much smaller flotilla of lightweight canopied cafés that meet new city regulations. The Wild West era of outdoor dining is dead; long live the domesticated version.
Dynamic cities keep tinkering with new ways of making themselves livable. Experimentation is generally a slow and fitful process. (Composting, not exactly a revolutionary concept, has been inching across the boroughs for years.) But the pandemic supercharged cities’ improvisational skills. As it hurtled along, tossing aside normalcy from every aspect of human behavior, officials scrambled to make their bureaucracies adapt. Colored tape, traffic cones, and cans of spray paint became the essential materials of sped-up city planning. Suddenly we were all living in a jury-rigged metropolis. Those adaptations could be comforting: Every Thursday afternoon for months, my wife and I toted a contraband six-pack and a couple of camp chairs to the park to meet two other couples. We arranged ourselves in an equilateral triangle with double points and ten-foot sides, shouting across the divide. But a DIY city can also be dangerous. Around that time, a flimsy sawhorse blocked off an avenue in my neighborhood, turning it into an open street; when the driver of a speeding box truck crashed right through it, I dodged a quick and violent death. In the weeks that followed my near miss, I saw a dozen other vehicles ram the same shattered sawhorse, which nobody ever replaced.
As it became obvious that pedestrians needed room to spread out — to breathe, move, and socialize — I hoped that some of those experiments would get absorbed into the city’s operating system. Once we passed the stage where we needed to keep each other at pole’s length, we wouldn’t just turn that turf back over to vehicles, would we? Having acquired the habit of fresh-air dining, surely we wouldn’t willingly get herded back into cramped and noisy quarters. Congestion pricing would whittle down traffic, making more acreage available for everything that isn’t traffic. Wouldn’t it?
The answers have been contradictory and often disappointing. Traffic returned in a cloud of non-glory, clogging the streets even more ferociously than it did before the pandemic. Even so, congestion pricing never got a chance. The Adams administration has built a fraction of the bike lanes it promised. Drivers are eyeing the parking spots that streeteries are about to relinquish en masse. And yet, the four years since the six-feet-apart admonitions emerged have left me guardedly (perhaps naïvely) optimistic. So has the new phase in outdoor dining.
Dining sheds lining the street in Little Italy.
Photo: Jimin Kim/SOPA Images/Shutterstock
The provisional greenhouse structures of the early pandemic allowed diners to eat outside in winter temperatures.
Photo: Lindsey Nicholson/Universal Images Group/Getty/Education Images
During the pandemic, thousands of restaurants all over the city expanded onto sidewalks and roadways under the city’s emergency program, all for free and with virtually no supervision. The anarchy was deliberate and crucial. At a time when many hesitated to leave their apartments, while squadrons of deliveristas braved snowstorms and viruses to bring them sustenance, the restaurant business depended on that economic respirator. The streets needed a shot of vibrancy, and outdoor turf offset the loss of off-limits dining rooms. Then indoor dining crept back, and some establishments effectively doubled their footprint by banging together outbuildings that could be heated, lit, and sheltered from foul weather. Just as the global food chain allows us to eat eggplant in winter and grapes in the spring, pandemic rules made it possible to picnic in polar conditions. Some places turned their sheds into ornate pavilions, others eventually abandoned them to squatters and rats. A reset was coming.
And so a team led by the mayor’s chief public realm officer, Ya-Ting Liu, spent months turning a scramble into a system. Now, restaurants can still colonize sidewalks and roadways, but they must abide by a menu of commonsense restrictions. Sidewalk cafés and roadway structures require separate applications and fees; eligible restaurants can submit either or both. The city recruited two architecture firms, SITU Studio and WXY, to develop prototypes and come up with design principles, and the results are elegant and pragmatic: Streeteries that occupy parking spaces must now be sturdy, lightweight, and modular, protected by water-filled barriers (no more sand or earth ballast). Floors must be laid down in sections so that they can be quickly taken up and the creatures dwelling beneath them can be evicted. Roofs must be the kind that flap. Most important, the whole apparatus gets dismantled and stored after Thanksgiving, to reappear in April — ending arctic dinners under erratic heat lamps that many romanticize but few still choose. The administration’s outdoor-dining website has links to designers, suppliers, and storage companies that can smooth the process. The city will finally lose that shantytown look of rotting shacks.
From left: New prototypes by WXY architecture and SITU Studio demonstrate the requirements about how the dining shed must meet the street and the curb. Photo: SITUPhoto: SITU
From top: New prototypes by WXY architecture and SITU Studio demonstrate the requirements about how the dining shed must meet the street and the curb.... From top: New prototypes by WXY architecture and SITU Studio demonstrate the requirements about how the dining shed must meet the street and the curb. Photo: SITUPhoto: SITU
Fabricating a dining shed that can be dissembled and put together, based on the new city guidelines, designed by WXY architecture + urban design and SITU Studio in partnership with many city agencies.
Photo: SITU
There’s a trade-off, of course: The process and the seasonality have proven too great a burden for a lot of business owners. Only 2,661 restaurants have applied for the permits — a fraction of the number that operated at the peak of the temporary arrangement. Meanwhile, cars are exercising their right of return, backing into the spaces that the old sheds surrender — happier news for die-hard drivers than for everybody else. Still, there’s a word for the advent of fees, permits, and bureaucracy: It’s called order. That’s something the city badly needs, especially now, when the forces of entropy seem ready to exploit any chink and crevice. With subway crime stubbornly refusing to sink — and ridership refusing to rise — back to pre-COVID levels, with rats on a rampage, homelessness endemic, migrants being housed in massive tents, food-delivery workers zipping around on lightless e-bikes propelled by incendiary batteries, and drivers picking off pedestrians by the dozen, the city is constantly fighting off the encroachments of chaos. In the last couple of years New Yorkers have mostly come out of their shells and reclaimed the streets, only to encounter the infuriating sort of pinch point where a streetside café, scaffolding, garbage bins, and a resting herd of delivery bikes all converge, making the sidewalk impassable. New needs demand new rules.
The temporary outdoor-dining scene nurtured Paris envy. Why can’t we have all those sprawling, boulevard cafés, or the corner joints where you can pause for a demi or an express and have it served en terrasse? But Paris is hardly a sidewalk free-for-all. The rules governing enclosed and seasonal terrassesare detailed and extensive, making New York’s new regime seem laissez-faire by comparison. For instance: Enclosed porches must be harmonious with the surrounding architecture, and café tables may not obstruct the passage of municipal sidewalk-cleaning machines — an utterly foreign concept in New York. The flood of clauses and prohibitions (recently fortified by new post-pandemic regulations) hasn’t prevented Paris from being Paris, and it shouldn’t scare New Yorkers back indoors. Our café scene will probably grow over time, if not to French dimensions, then enough so that those who now complain that it’s dying may eventually start complaining that it’s out of control.
A prototype of a dining shed that follows the new DOT rules, by WXY architecture + urban design and SITU Studio.
Photo: SITU
A collaboration to show the new city guidelines by WXY architecture and SITU Studio.
Photo: SITU
Even so, the program’s success will depend less on rules and procedures than how they are administered. The Department of Transportation tried to keep the process relatively frictionless, but the city council introduced a potential booby trap. The legislation imposes public hearings along the way to approval, and those are opportunities for neighbors to try quashing applications with complaints about lost parking, smells, rats, and noise. That in turn provides more opportunities for employment for lawyers and expediters. The local city councilmember, who must sign off on each application, can ask the entire city council to vote on a particularly problematic sidewalk café (though not on its roadway cousin). DOT predicts that such interference will be rare, and the vast majority of applications will sail through. Maybe, but New Yorkers are resourceful in finding ways to say no. Opponents will quickly figure out how to turn every parking spot and table into a battleground. The outdoor dining scene needs to be tamed and controlled, not snuffed out by obstructionists. We can’t have a system that’s subject to political hijacking.
Streeteries are just one component of the post-pandemic commons, where foot by foot and spot by spot, we claw back public space from the monopoly of cars. Like cities all over the world, New York keeps having to renegotiate competing, and increasing, demands for public space without being able to create much more of it. Deleting parking spaces and traffic lanes has proven to be a rich, if contested, source of acreage for a slew of other uses, including electric-vehicle charging stations, waste containers, package-delivery zones, and yes, outdoor dining. The city has been turning parking into plazas since 2007, and the pandemic practice of opening car-free streets led to the Open Streets program, which boosts retail businesses and gives New Yorkers a taste of a fewer-car future. That’s one innovation that remains popular and is still going strong: There are now 90 plazas and more than 200 open streets in all five boroughs, and the Adams administration has committed $375 million to public-space improvements and turned over another million square feet to pedestrians. These changes, broken up into pocket projects and distributed around the city, can feel sporadic and meager on the ground, but they add up over time.
Plazas, open streets, wider sidewalks, roadway dining — each of these programs has its own separate history and administrative boundaries, but when they are numerous and close enough, they flow gratifyingly together, merging the official and the informal. On a recent afternoon I walked through the newish Montefiore Square at Broadway and 137th Street, a handsomely designed, sloped mini-park by SWA/Balsley, where a handful of middle-aged men were blissing out to music by the Argentine folk singer Mercedes Sosa. Up the street, an intergenerational cluster of neighbors had colonized the sidewalk with beach chairs and a soundtrack of vintage Colombian cumbia. A few more blocks took me past a knot of young people lounging around a parked SUV broadcasting Afro-Mexican hip-hop, to Johnny Hartman Plaza, the intersection of Hamilton Avenue and 143rd Street that’s been pedestrianized with planters, paint, and café tables. The neighborhood’s social ecosystem looks organic, but it’s the work of a dozen city agencies and neighborhood groups, millions of dollars, and years of planning. (The work isn’t done: I noticed a brisk open-air drug trade taking place along West 144th Street.)
Change is a gradual, uneven, and protracted process, one that doesn’t necessarily reveal itself in before-and-after snapshots from 2020 and 2024. The city is always trying to formalize the casual and eliminate the slovenly, without sacrificing authenticity. It’s a delicate operation that takes time and we don’t always get it right. And yet, hesitantly and much too slowly, New York is finally enshrining the realization that the city’s soul resides in its streets and needs room to thrive there.
By submitting your email, you agree to our
Terms and Privacy Notice
and to receive email correspondence from us. This site is protected by reCAPTCHA and the Google
Privacy Policy and
Terms of Service apply.
or
Already a subscriber?
What is your email?
This email will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
Password must be at least 8 characters and contain:
Lower case letters (a-z)
Upper case letters (A-Z)
Numbers (0-9)
Special Characters (!@#$%^&*)
This password will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
You’re in!
As part of your account, you’ll receive occasional updates and offers from New York, which you can opt out of anytime.
or
Already a subscriber?
What is your email?
This email will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
Password must be at least 8 characters and contain:
Lower case letters (a-z)
Upper case letters (A-Z)
Numbers (0-9)
Special Characters (!@#$%^&*)
This password will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
You’re in!
As part of your account, you’ll receive occasional updates and offers from New York, which you can opt out of anytime.
Already a subscriber?
Already a subscriber?
`;
// integrate Sub(x) scripts and elements
if (hostname !== 'subs.nymag.com') { // do not integrate on this subdomain
document.head.appendChild(trackingScript);
document.body.insertAdjacentHTML('beforeend', subXAnimationElements);
}
There was an error processing the request. Please try again later."}).catch(e=>console.error("Error verifying email: ",e)))(r.querySelector(".content"),o.bannerCTAVerification)})):(l.remove(),s.remove()),o.dismissable||n.remove(),o.useAlertIcon||a.remove(),r.classList.add("show"),n.addEventListener("click",()=>{u(),r.classList.remove("show")})}else r.remove()}});
}, {"1":1,"6":6,"12":12,"35":35,"40":40}];
window.modules["global-nav.client"] = [function(require,module,exports){"use strict";const dom=require(4),auth=require(12),signInButton=dom.find(".user-signin"),signOutButton=dom.find(".user-signout"),globalNav=dom.find('[class^="global-nav"]'),body=dom.find("body"),dropdownItems=dom.findAll(".dropdown-wrap"),gtm=require(1),appendLandingPageParams=require(135),pageUri=require(124).getPageUri(),subscriptionPromoLinks=dom.findAll(".persist-params"),searchString=window.location.search||"";function closeDropdowns(e){let n=globalNav.querySelectorAll(".dropdown.open");dropdownItems.forEach(function(t){let o=t.querySelector(".dropdown");!n||t.contains(e.target)&&27!==e.keyCode||o.classList.remove("open")})}function gtmSendReport(e,n,t){let o={eventCategory:"ecommerce",eventAction:"componentClick",brand:e,dimension23:"global-nav",list:pageUri,pageZone:"header",variant:"nav-link"};"global-nav-link"===t&&(o.eventLabel=n.href),gtm.reportNow(o)}function updateElementTargetUrlsIfQueryStrings(e){if(searchString){const n=new URLSearchParams(searchString);let t=e.href;if(t.includes("?")){const o=t.split("?"),i=new URLSearchParams(o[1]);for(let e of n.entries())i.set(e[0],e[1]);t=`${o[0]}?${i.toString()}`,e.href=t}else e.href=`${t}?${n.toString()}`}}function init(e){const n=e.querySelectorAll(".to-landing-page");window.addEventListener("auth:init",()=>{signInButton.addEventListener("click",function(e){e.preventDefault(),auth.showEmbeddedLoginFlow("top navigation")}),signOutButton.addEventListener("click",function(e){e.preventDefault(),gtmSendReport("Sign Out",e.target,"user-info-link"),auth.logout()}),auth.isAuthenticated()&&e.classList.add("signed-in"),auth.isSubscriber()&&e.classList.add("subscribed"),e.querySelectorAll(".user-link").forEach(e=>{e.classList.add("active")}),subscriptionPromoLinks.forEach(e=>{updateElementTargetUrlsIfQueryStrings(e)}),appendLandingPageParams(n)})}dropdownItems.forEach(function(e){e.addEventListener("click",function(){e.querySelector(".dropdown").classList.toggle("open")})}),body.addEventListener("click",closeDropdowns),document.addEventListener("keydown",closeDropdowns),globalNav.addEventListener("click",function(e){let n=e.target;n.classList.contains("global-nav-track")&>mSendReport(n.text,n,"global-nav-link")}),module.exports=init;
}, {"1":1,"4":4,"12":12,"124":124,"135":135}];
window.modules["aaa-module-mounting.legacy"] = [function(require,module,exports){"use strict";const _pickBy=require(221),_each=require(406),Fingerprint2=require(408),DS=require(407),Eventify=require(246);function registerGlobals(){window.DS=DS,window.Eventify=Eventify,window.Fingerprint2=Fingerprint2,DS.value("Eventify",Eventify),DS.value("Fingerprint2",Fingerprint2),DS.value("$document",window.document),DS.value("$window",window)}function mountDollarSliceComponents(){DS.service("components",["$document","$module",function(e,n){var o=_pickBy(n.definitions,e=>e.providerStrategy===n.providers.controller),r=Object.keys(o);function t(e){return o=>{try{n.get(e,o)}catch(e){logMountError(o,e)}}}_each(r,n=>{var o=e.querySelectorAll('[data-uri*="/_components/'+n+'/"]'),r=e.querySelectorAll('[data-uri$="/_components/'+n+'"]');_each(o,t(n)),_each(r,t(n))}),this.components=r}]),DS.get("components")}function logMountError(e,n){const o=e.outerHTML.slice(0,e.outerHTML.indexOf(e.innerHTML));console.error("Error attaching controller to "+o,n)}registerGlobals(),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{mountDollarSliceComponents()}):mountDollarSliceComponents();
}, {"221":221,"246":246,"406":406,"407":407,"408":408}];
window.modules["ads.legacy"] = [function(require,module,exports){"use strict";const _map=require(118),_forEach=require(107),_isString=require(268),_intersectionWith=require(409),_isEqual=require(274),_each=require(406),_debounce=require(182),_sortBy=require(205),page=require(124),visit=require(114);DS.service("adService",["Eventify","$cid","$document","$window",function(e,t,a,i){var o,n,s,r,d,c,u,l,g={},p=this,h=[],f=visit.getQueryParamsObject(["utm_campaign"]),m=document.querySelector('script[data-type="ad-a9"]'),b=[],w=!1,v=[],y=document.querySelector('script[data-name="ad-doubleverify"]');document.querySelector('script[data-name="concert-ads"]')||(i.NYM={},i.NYM.analytics={},i.NYM.analytics.adStartTime=i.performance.now(),i.googletag=i.googletag||{},i.googletag.cmd=i.googletag.cmd||[],u=i.googletag,(m||y)&&(i.googletag.cmd=i.googletag.cmd||[],i.googletag.cmd.push(function(){i.googletag.pubads().disableInitialLoad()})),m&&(l=i.setInterval(function(){void 0!==window.apstag&&void 0!==window.apstag.timeout&&(i.clearInterval(l),window.apstag.cleared=!0,l=null)},10),setTimeout(function(){l&&(i.clearInterval(l),i.googletag.pubads().refresh(),window.apstag||console.log("MESSAGE: Timeout for A9 load exceeded, aborting"))},500)),y&&(b.push(new Promise(function(e){w?e():v.push(e)})),c=i.setTimeout(T,2500)),o=function(e){var t,a,o=e.data,n=[];return o.loaded?e:(o.loaded=!0,t=null,(t=o.sizes?u.defineSlot(o.name,o.sizes,o.id).addService(u.pubads()):u.defineOutOfPageSlot(o.name,o.id).addService(u.pubads())).setTargeting("adid",o.id),f.hasOwnProperty("utm_campaign")&&t.setTargeting("utmcamp",f.utm_campaign),a=p.getAdCount(o.label),t.setTargeting("label",o.label+"_"+o.site+"-"+a),u.display(o.id),u.pubads().addEventListener("slotOnload",function(){i.NYM.analytics.firstAdLoadTime||(i.NYM.analytics.firstAdLoadTime=i.performance.now(),i.NYM.analytics.firstAdLoadLabel=e.data.label)}),n=_(o),Promise.all(b).then(function(){n?window.apstag&&window.apstag.cleared?window.apstag.fetchBids({slots:[n],timeout:window.apstag.timeout},function(){u.cmd.push(function(){window.apstag.setDisplayBids(),u.pubads().refresh([t],{changeCorrelator:!1})})}):y&&u.pubads().refresh([t],{changeCorrelator:!1}):u.pubads().refresh([t],{changeCorrelator:!1})}),e.slot=t,e)},n=function(e){var a,i,o,n=t(),s=e.getAttribute("data-name"),r=e.getAttribute("data-sizes"),d=e.getAttribute("data-label"),c=e.getAttribute("data-site");n=e.id,r&&r.length?(r=r.split(","),a=[],_map(r,function(e){e=e.split("x"),i=parseInt(e[0]),o=parseInt(e[1]),a.push([i,o])})):(e.classList.add("oop"),a=!1),this.data={id:n,name:s,sizes:a,loaded:!1,label:d,site:c},g[n]=this},r=function(e){u.cmd.push(function(){var t=o(e);g[e.data.id]=t})},s=function(e){var t=[];e.slot?(t=_(e))&&window.apstag&&window.apstag.cleared&&window.apstag.fetchBids({slots:[t],timeout:window.apstag.timeout},function(){u.cmd.push(function(){window.apstag.setDisplayBids(),u.pubads().refresh([e.slot],{changeCorrelator:!1})})}):e&&r(e)},u.cmd.push(function(){var e,t,o,n=page.getMeta("article:tag"),s=page.getMeta("author"),r=i.location.href,d=(e=a.head.querySelector(".head-gtm"),t=a.body.querySelector(".gtm"),e&&"top"===e.getAttribute("data-gtm")?"gtmtop":t&&"bottom"===t.getAttribute("data-gtm")?"gtmbottom":"");o=[],_forEach([n,s,d],function(e){_forEach(e.split(","),function(e){(e=e.trim().toLowerCase().replace(/\s/g,"-").replace(/\'|\’/g,"")).length&&o.push(e)})}),u.pubads().setTargeting("kw",o),u.pubads().setTargeting("entry_group",o),r=r.slice(r.lastIndexOf("/")+1),u.pubads().setTargeting("pn",r),u.companionAds().setRefreshUnfilledSlots(!0),u.pubads().enableAsyncRendering(),u.enableServices()}),this.load=r,this.create=function(e){return new n(e)},this.refresh=function(e){var t;_isString(e)?(t=this.getById(e),s(t)):s(e)},this.remove=function(e){var t=e.data.id;a.getElementById(t).innerHTML=""},this.getAdCount=function(e){var t,a=0,i=Object.keys(g);return _each(i,function(i){(t=g[i]).data.loaded&&t.data.label===e&&a++}),a},this.getById=function(e){return g[e]},d=_debounce(function(){var e={TopLeaderboard:1,RightColTopMPU:2,outOfPage:99,"homepageTakeover/TopLeaderboard":1},t=_sortBy(h,function(t){return e[t.data.label]||10});_forEach(t,function(e){return e.data.sizes?r(e):i.setTimeout(function(){r(e)},2e3)}),y&&window.PQ.cmd.push(()=>{try{window.PQ.loadSignals(["ids","bsc","vlp"],T)}catch(e){T(),console.error(`There has been an error loading Double Verify signals: ${e}`)}}),h=[]},10),this.addToPageLoadQueue=function(e){h.push(e),d()});function _(e){var t,a=e.sizes;return a=_intersectionWith(a,[[970,250],[970,90],[728,90],[300,600],[300,250],[320,100],[320,50]],_isEqual),e.sizes&&e.sizes.length&&(t={slotID:e.id,sizes:a,slotName:e.label}),t}function T(){i.clearTimeout(c),w=!0,_forEach(v,function(e){e()})}}]);
}, {"107":107,"114":114,"118":118,"124":124,"182":182,"205":205,"268":268,"274":274,"406":406,"409":409}];
window.modules["cid.legacy"] = [function(require,module,exports){"use strict";DS.service("$cid",function(){var r=Math.floor(100*Math.random());return function(){return"cid-"+ ++r}});
}, {}];
window.modules["client.legacy"] = [function(require,module,exports){"use strict";require("cid.legacy"),require("ads.legacy"),require("facebook.legacy"),require("aaa-module-mounting.legacy");
}, {"cid.legacy":"cid.legacy","ads.legacy":"ads.legacy","facebook.legacy":"facebook.legacy","aaa-module-mounting.legacy":"aaa-module-mounting.legacy"}];
window.modules["facebook.legacy"] = [function(require,module,exports){"use strict";DS.service("facebook",[function(){this.fb=function(i){window.FB&&window.FB[i].apply(this,Array.prototype.slice.call(arguments,1))}}]);
}, {}];
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o typeof key === 'string' && key.match(/\.legacy$/)).forEach(key => window.require(key));
}
function tryToMount(fn, el, name) {
try {
fn(el); // init the controller
} catch (e) {
const elementTag = el.outerHTML.slice(0, el.outerHTML.indexOf(el.innerHTML));
console.error(`Error initializing controller for "${name}" on "${elementTag}"`, e);
}
}
/**
* mount client.js component controllers
*/
function mountComponentModules() {
Object.keys(window.modules).filter(key => typeof key === 'string' && key.match(/\.client$/)).forEach(key => {
let controllerFn = window.require(key);
if (typeof controllerFn === 'function') {
const name = key.replace('.client', ''),
instancesSelector = `[data-uri*="_components/${name}/"]`,
defaultSelector = `[data-uri$="_components${name}"]`,
instances = document.querySelectorAll(instancesSelector),
defaults = document.querySelectorAll(defaultSelector);
for (let el of instances) {
tryToMount(controllerFn, el, name);
}
for (let el of defaults) {
tryToMount(controllerFn, el, name);
}
}
});
}
// Make sure that a `window.process.env.NODE_ENV` is available in the client for any dependencies,
// services, or components that could require it
// note: the `` value is swapped for the actual environment variable in /lib/cmd/compile/scripts.js
window.process = window.process || {};
window.process.env = window.process.env || {};
if (!window.process.env.NODE_ENV) {
window.process.env.NODE_ENV = '';
}
// note: legacy controllers that require legacy services (e.g. dollar-slice) must
// wait for DOMContentLoaded to initialize themselves, as the files themselves must be mounted first
mountLegacyServices();
mountComponentModules();
// ]]